]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Render RegiserThrottle extra profile data properly
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 13 Feb 2016 00:16:34 +0000 (01:16 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 13 Feb 2016 00:16:34 +0000 (01:16 +0100)
plugins/RegisterThrottle/RegisterThrottlePlugin.php
plugins/RegisterThrottle/actions/ipregistrations.php

index 88f2a9677139447017ff49a1255eb0f2ce55fb0d..552420d8f6b56036fb963ac6784820ec2103f8a4 100644 (file)
@@ -160,7 +160,7 @@ class RegisterThrottlePlugin extends Plugin
             return true;
         }
 
-        $ri = Registration_ip::getKV('user_id', $profile->id);
+        $ri = Registration_ip::getKV('user_id', $target->getID());
         $ipaddress = null;
         if ($ri instanceof Registration_ip) {
             $ipaddress = $ri->ipaddress;
@@ -172,12 +172,17 @@ class RegisterThrottlePlugin extends Plugin
 
         $action->element('h2', null, _('Registration IP'));
 
+        // TRANS: Label for the information about which IP a users registered from.
         $action->element('strong', null, _('Registered from:'));
-        $action->element('a',
-                            [ 'class'=>'ipaddress',
-                              'href'=>common_local_url('ipregistrations', array('ipaddress'=>$ipaddress)),
-                            ],
-                            $ipaddress ?: 'unknown');
+        $el = 'span';
+        $attrs = ['class'=>'ipaddress'];
+        if (!is_null($ipaddress)) {
+            $el = 'a';
+            $attrs['href'] = common_local_url('ipregistrations', array('ipaddress'=>$ipaddress));
+        }
+        $action->element($el, $attrs,
+                            // TRANS: Unknown IP address.
+                            $ipaddress ?: _('unknown'));
 
         $action->elementEnd('div');
     }
index a748a9d0b2e05468bf5eb10328f5186f10932023..8d74803ae203354979bc79423a7f53fc80db73ae 100644 (file)
@@ -15,7 +15,7 @@ class IpregistrationsAction extends ManagedAction
 
     protected function doPreparation()
     {
-        if (!$scoped->hasRight(Right::SILENCEUSER) && !$scoped->hasRole(Profile_role::ADMINISTRATOR)) {
+        if (!$this->scoped->hasRight(Right::SILENCEUSER) && !$this->scoped->hasRole(Profile_role::ADMINISTRATOR)) {
             throw new AuthorizationException(_('You are not authorized to view this page.'));
         }