+
+function common_location_shared()
+{
+ // Get default setting
+ $cfg = common_config('location', 'share');
+
+ if ($cfg == 'always') {
+ // Always enabled
+ return true;
+ } elseif ($cfg == 'never') {
+ // Never enabled
+ return false;
+ }
+
+ // Is the user logged-in?
+ if (common_logged_in()) {
+ // Get current user
+ $user = common_current_user();
+
+ // Is it there?
+ if ($user instanceof User) {
+ // Yes, get profile
+ $profile = $user->getProfile();
+
+ // Get it from the profile
+ return $profile->shareLocation();
+ }
+ }
+
+ // User is not logged in, get default
+ return common_config('location', 'sharedefault');
+}