]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/FollowEveryone/FollowEveryonePlugin.php
Merge branch '0.9.x'
[quix0rs-gnu-social.git] / plugins / FollowEveryone / FollowEveryonePlugin.php
index 67ed927ce0000799307fd77fcd3b2c2dc004e426..228efc93573a93ba4cd3800ee02845db3a1c0c4d 100644 (file)
@@ -46,7 +46,6 @@ if (!defined('STATUSNET')) {
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-
 class FollowEveryonePlugin extends Plugin
 {
     /**
@@ -62,7 +61,6 @@ class FollowEveryonePlugin extends Plugin
      * @return boolean hook value
      *
      */
-
     function onEndUserRegister(&$newProfile, &$newUser)
     {
         $otherUser = new User();
@@ -112,7 +110,6 @@ class FollowEveryonePlugin extends Plugin
      *
      * @return boolean hook value; true means continue processing, false means stop.
      */
-
     function onCheckSchema()
     {
         $schema = Schema::get();
@@ -135,7 +132,6 @@ class FollowEveryonePlugin extends Plugin
      *
      * @return boolean hook value; true means continue processing, false means stop.
      */
-
     function onAutoload($cls)
     {
         $dir = dirname(__FILE__);
@@ -150,6 +146,45 @@ class FollowEveryonePlugin extends Plugin
         }
     }
 
+    /**
+     * Show a checkbox on the profile form to ask whether to follow everyone
+     *
+     * @param Action $action The action being executed
+     *
+     * @return boolean hook value
+     */
+    function onEndProfileFormData($action)
+    {
+        $user = common_current_user();
+
+        $action->elementStart('li');
+        // TRANS: Checkbox label in form for profile settings.
+        $action->checkbox('followeveryone', _('Follow everyone'),
+                          ($action->arg('followeveryone')) ?
+                          $action->arg('followeveryone') :
+                          User_followeveryone_prefs::followEveryone($user->id));
+        $action->elementEnd('li');
+
+        return true;
+    }
+
+    /**
+     * Save checkbox value for following everyone
+     *
+     * @param Action $action The action being executed
+     *
+     * @return boolean hook value
+     */
+    function onEndProfileSaveForm($action)
+    {
+        $user = common_current_user();
+
+        User_followeveryone_prefs::savePref($user->id,
+                                            $action->boolean('followeveryone'));
+
+        return true;
+    }
+
     /**
      * Provide version information about this plugin.
      *
@@ -158,7 +193,6 @@ class FollowEveryonePlugin extends Plugin
      * @return boolean hook value
      *
      */
-
     function onPluginVersion(&$versions)
     {
         $versions[] = array('name' => 'FollowEveryone',