X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FRegisterThrottle%2FRegisterThrottlePlugin.php;h=e3982427da5053b5400aa7bce0e38a8095339a78;hb=579fc11862173c8be3a623ebc3248ce9d61835a8;hp=7e2dde80fa1f2d9cdb363aae7f97f800cc7c7ee4;hpb=ae557ed43643b30e50a6d5b754c53c7f7205e76f;p=quix0rs-gnu-social.git diff --git a/plugins/RegisterThrottle/RegisterThrottlePlugin.php b/plugins/RegisterThrottle/RegisterThrottlePlugin.php index 7e2dde80fa..e3982427da 100644 --- a/plugins/RegisterThrottle/RegisterThrottlePlugin.php +++ b/plugins/RegisterThrottle/RegisterThrottlePlugin.php @@ -158,7 +158,7 @@ class RegisterThrottlePlugin extends Plugin foreach ($ids as $id) { $profile = Profile::staticGet('id', $id); if ($profile && $profile->isSilenced()) { - throw new Exception(_("A banned user has registered from this address.")); + throw new Exception(_m("A banned user has registered from this address.")); } } } @@ -167,28 +167,24 @@ class RegisterThrottlePlugin extends Plugin } /** - * Called after someone registers. + * Called after someone registers, by any means. * * We record the successful registration and IP address. * - * @param Action $action Action that is being executed + * @param Profile $profile new user's profile + * @param User $user new user * * @return boolean hook value * */ - function onEndRegistrationTry($action) + function onEndUserRegister($profile, $user) { $ipaddress = $this->_getIpAddress(); if (empty($ipaddress)) { - throw new ServerException(_m('Cannot find IP address.')); - } - - $user = common_current_user(); - - if (empty($user)) { - throw new ServerException(_m('Cannot find user after successful registration.')); + // User registration can happen from command-line scripts etc. + return true; } $reg = new Registration_ip();