]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
More configuration options for location sharing
authorEvan Prodromou <evan@status.net>
Mon, 28 Dec 2009 22:43:34 +0000 (14:43 -0800)
committerEvan Prodromou <evan@status.net>
Mon, 28 Dec 2009 22:43:34 +0000 (14:43 -0800)
classes/User.php
lib/default.php

index 2bcb7c2a0a1336918b2f30e0e461ef8da9f9c071..34151778c5c3274b89cf6f6562334e11c29249a7 100644 (file)
@@ -999,17 +999,25 @@ class User extends Memcached_DataObject
 
     function shareLocation()
     {
-        $share = true;
+        $cfg = common_config('location', 'share');
 
-        $prefs = User_location_prefs::staticGet('user_id', $this->id);
+        if ($cfg == 'always') {
+            return true;
+        } else if ($cfg == 'never') {
+            return false;
+        } else { // user
+            $share = true;
 
-        if (empty($prefs)) {
-            $share = common_config('location', 'share');
-        } else {
-            $share = $prefs->share_location;
-            $prefs->free();
-        }
+            $prefs = User_location_prefs::staticGet('user_id', $this->id);
 
-        return $share;
+            if (empty($prefs)) {
+                $share = common_config('location', 'sharedefault');
+            } else {
+                $share = $prefs->share_location;
+                $prefs->free();
+            }
+
+            return $share;
+        }
     }
 }
index b5eda7b2cf2650d16da116e902a4184a44fb217c..8a70ed3fa15d0672899f0d4c22e68abf062b7349 100644 (file)
@@ -226,7 +226,8 @@ $default =
         'message' =>
         array('contentlimit' => null),
         'location' =>
-        array(),
+        array('share' => 'user', // whether to share location; 'always', 'user', 'never'
+              'sharedefault' => true),
         'omb' =>
         array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates
         'logincommand' =>