X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FFollowEveryone%2FFollowEveryonePlugin.php;h=228efc93573a93ba4cd3800ee02845db3a1c0c4d;hb=c78170a2757983e99655219502ec36cada7547f5;hp=67ed927ce0000799307fd77fcd3b2c2dc004e426;hpb=7a80ebeb13c88fc543b1d87f0207ba1a00a652f5;p=quix0rs-gnu-social.git diff --git a/plugins/FollowEveryone/FollowEveryonePlugin.php b/plugins/FollowEveryone/FollowEveryonePlugin.php index 67ed927ce0..228efc9357 100644 --- a/plugins/FollowEveryone/FollowEveryonePlugin.php +++ b/plugins/FollowEveryone/FollowEveryonePlugin.php @@ -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',