Jump to content

Topic on Project:Support desk

How do hide "SpecialPages" for anonymous users?

2
82.210.238.62 (talkcontribs)

Hi guys,

I'm running

MediaWiki: 1.11.0 PHP: 5.2.0 (cgi-fcgi) MySQL: 5.1.72-community Server: IIS 8.5 (Win 2012 R2)

and I added inside my LocalSettings.php

$wgGroupPermissions['*']['read'] = false;

to prevent anonymous user to read my wiki.

So far so good, unfortunately, every time an anonymous user clicks on an "Special" page on my index.php (e.g. random article) he sees a very nasty error message: Internal Error - Invalid special page name "".

If I disable "$wgGroupPermissions['*']['read'] = false;" inside my LocalSettings.php the error message is gone.

Is there any way to hide this special pages for anonymous users? I'm looking for something like this:

  • navigation
    • mainpage|mainpage
    • portal-url|portal
    • currentevents-url|currentevents
    • recentchanges-url|recentchanges

if (!anonymousUser) {

  ** randompage-url|randompage

}

    • helppage|help
    • sitesupport-url|sitesupport

inside my Sidebar (index.php?title=MediaWiki:Sidebar)

Is there any way to solve my issue? Thanks in advance. Please don't ask me about my MW version.

88.130.115.109 (talkcontribs)

Let me rephrase your question: You want that, if a user does not have access to a special page, this page should not be linked in menus.

For the sidebar, there are two hooks, which I could find quickly: Manual:Hooks/SidebarBeforeOutput and Manual:Hooks/SkinBuildSidebar. According to the manual pages, you should better use SkinBuildSidebar as that one would be better for caching.

Anyway, I am pretty sure that there still are links to special pages more or less everywhere in your wiki. I do not know a way to hide them all - basically MediaWiki is not made for access protection.

Reply to "How do hide "SpecialPages" for anonymous users?"