Show "Not logged in" message
authorStephan Gambke <s7eph4n@gmail.com>
Wed, 24 Feb 2016 20:54:48 +0000 (21:54 +0100)
committerJdlrobson <jrobson@wikimedia.org>
Tue, 17 May 2016 20:06:06 +0000 (20:06 +0000)
Show "Not logged in" message left or right (depending on language) of an anon
user's personal tools in case general edit permission is given.

The display of the message was previously done in MW core
(SkinTemplate::buildPersonalUrls, introduced by I6f44e3e5d), which needs to be
reverted first (done in I5cfa9b4e).

Bug: T127758
Depends-on: I5cfa9b4e
Change-Id: Ic560d3fd4e9f6ad194e6ff928c8749084af311b5

VectorTemplate.php

index 5203926..7a02b36 100644 (file)
@@ -499,10 +499,32 @@ class VectorTemplate extends BaseTemplate {
                                                <h3 id="p-personal-label"><?php $this->msg( 'personaltools' ) ?></h3>
                                                <ul<?php $this->html( 'userlangattributes' ) ?>>
                                                        <?php
+
+                                                       $notLoggedIn = '';
+
+                                                       if ( !$this->getSkin()->getUser()->isLoggedIn() &&
+                                                               User::groupHasPermission( '*', 'edit' ) ){
+
+                                                               $notLoggedIn =
+                                                                       Html::rawElement( 'li',
+                                                                               [ 'id' => 'pt-anonuserpage' ],
+                                                                               $this->getMsg( 'notloggedin' )->escaped()
+                                                                       );
+
+                                                       }
+
+                                                       if ( !$this->data[ 'rtl' ] ) {
+                                                               echo $notLoggedIn;
+                                                       }
+
                                                        $personalTools = $this->getPersonalTools();
                                                        foreach ( $personalTools as $key => $item ) {
                                                                echo $this->makeListItem( $key, $item );
                                                        }
+
+                                                       if ( $this->data[ 'rtl' ] ) {
+                                                               echo $notLoggedIn;
+                                                       }
                                                        ?>
                                                </ul>
                                        </div>