X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FUserLimit%2FUserLimitPlugin.php;h=2bb1218a72c0b0d1333178af526d97d2bd6eadac;hb=a75b1df62727ce74fdf4d8d98421558b153458e1;hp=ab3187299ed8ef2eec4f99e561f3a012c7ad996a;hpb=59119482ca34540bd7f0a2a1aa994de1d5328ea2;p=quix0rs-gnu-social.git diff --git a/plugins/UserLimit/UserLimitPlugin.php b/plugins/UserLimit/UserLimitPlugin.php index ab3187299e..2bb1218a72 100644 --- a/plugins/UserLimit/UserLimitPlugin.php +++ b/plugins/UserLimit/UserLimitPlugin.php @@ -45,12 +45,11 @@ if (!defined('STATUSNET')) { * * @seeAlso Location */ - class UserLimitPlugin extends Plugin { public $maxUsers = null; - function onStartUserRegister(&$user, &$profile) + public function onStartUserRegister(Profile $profile) { $this->_checkMaxUsers(); return true; @@ -65,13 +64,16 @@ class UserLimitPlugin extends Plugin function _checkMaxUsers() { if (!is_null($this->maxUsers)) { - $cls = new User(); $cnt = $cls->count(); if ($cnt >= $this->maxUsers) { - $msg = sprintf(_('Cannot register; maximum number of users (%d) reached.'), + // TRANS: Error message given if creating a new user is not possible because a limit has been reached. + // TRANS: %d is the user limit (also available for plural). + $msg = sprintf(_m('Cannot register because the maximum number of users (%d) for this site was reached.', + 'Cannot register because the maximum number of users (%d) for this site was reached.', + $this->maxUsers), $this->maxUsers); throw new ClientException($msg); @@ -79,13 +81,14 @@ class UserLimitPlugin extends Plugin } } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'UserLimit', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:UserLimit', + 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/UserLimit', 'description' => + // TRANS: Plugin description. _m('Limit the number of users who can register.')); return true; }