Last modified: 2012-12-13 19:45:32 UTC
On read-only wikis (e.g., no accounts except for WikiSysop, who adds documents for others to read, but not alter, and logs in himself via the link on Special:SpecialPages) sure, one can eliminate the Login link altogether from the upper right corner of the (Monobook) screen: >function JidanniNoLoginLinkOnMainPage(&$personal_urls){unset($personal_urls['login']);return true;} >$wgHooks['PersonalUrls'][]='JidanniNoLoginLinkOnMainPage'; The problem is in text browsers, one will still see > Views > > • Page > • View source > • History > > Personal tools > > Navigation > > • Main Page > • Recent changes > • Random page i.e., an empty "Personal tools". Looking for a way of eliminating the words "Personal tools" above, one finds MonoBook.php has checks like > function languageBox() { > if( $this->data['language_urls'] ) { but unfortunately no check is done for Personal tools, before "sending out the delivery truck with an empty package. Might as well have stayed at home." Anyway, if there were any such check, we could tailor our above hood to work with it (e.g., do nothing if already logged in, else unset($personal_urls) altogether.) I didn't check e.g., "Views" etc. for similar problems. Each such group on the page needs to check first before making its <h5> etc. Nor did I check other skins...
This is a bug in your PHP extension code. unset() doesn't do what you're trying to do on arrays -- it sets the item value to NULL but leaves the key intact and present. Use array_splice or array_filter or whathaveyou to produce a new array that contains the elements you want.
Excuse me but if you take a closer look at Monobook.php, you will see that no less than <div class="portlet" id="p-personal"> <h5>Personal tools</h5> <div class="pBody"> <ul lang="en" xml:lang="en"> </ul> </div> </div> will always be emitted, as there are no enclosing if()s or functions to prevent it, no matter what the user does in hooks. Same with the "views" <h5>. At the most he could do something crazy, like set Mediawiki:Personaltools to "", but at most that would buy him an empty <h5></h5>.
I see the vector skin has the same problem. I'll reset the Component above. Dear Vector skin maintainer: when fixed please don't close this bug, but instead change the Component back to "Page rendering" and remove &useskin=vector from the URL above, unless you fix the other skins too. Thanks.
Resolved for Vector in r52937.
OK, now could someone apply similar changes to Monobook, etc. Thanks
Right, time to tick this one off methinks: https://gerrit.wikimedia.org/r/#/c/37224/
As Matmarex points out on the Gerrit changeset, there isn't a good way of doing this without breaking user scripts in wikis that want to do that; and moreover, we want to be consistent with our portlets and none of the others are hidden if empty - these days, Vector doesn't suppress an empty p-personal, for example. Fortunately modern text browsers won't read it out anyway if it's display:none;. Resolved WONTFIX.