- if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
- if ( $sp->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
- if ( $target->isBlocked() && $target->getBlock()->getType() != Block::TYPE_AUTO ) {
- $tools['block'] = $linkRenderer->makeKnownLink( # Change block link
- SpecialPage::getTitleFor( 'Block', $username ),
- $sp->msg( 'change-blocklink' )->text()
- );
- $tools['unblock'] = $linkRenderer->makeKnownLink( # Unblock link
- SpecialPage::getTitleFor( 'Unblock', $username ),
- $sp->msg( 'unblocklink' )->text()
- );
- } else { # User is not blocked
- $tools['block'] = $linkRenderer->makeKnownLink( # Block link
- SpecialPage::getTitleFor( 'Block', $username ),
- $sp->msg( 'blocklink' )->text()
- );
- }
+ if ( $sp->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
+ if ( $target->getBlock() && $target->getBlock()->getType() != Block::TYPE_AUTO ) {
+ $tools['block'] = $linkRenderer->makeKnownLink( # Change block link
+ SpecialPage::getTitleFor( 'Block', $username ),
+ $sp->msg( 'change-blocklink' )->text()
+ );
+ $tools['unblock'] = $linkRenderer->makeKnownLink( # Unblock link
+ SpecialPage::getTitleFor( 'Unblock', $username ),
+ $sp->msg( 'unblocklink' )->text()
+ );
+ } else { # User is not blocked
+ $tools['block'] = $linkRenderer->makeKnownLink( # Block link
+ SpecialPage::getTitleFor( 'Block', $username ),
+ $sp->msg( 'blocklink' )->text()
+ );