0

In a MediaWiki-based non-communal website there are some HTML elements that should be presented only for logged-in-users (an administration menu or some of its links).

Usually if I want to hide something for a certain group of users like anonymous users I browse into the website when logged-out, and then take a <body> CSS ID or Class like #anonymous-user to create some condition like this:

#anonymous-user .administration-menu {display: none}

I tried to search for a <body> CSS ID or Class that I could utilize to hide things for anonymous users in MediaWiki but found none.

How could I create one myself?

  • All display:none is doing is hiding a section of a page if a user is using your stylesheet, which they can turn off. If there are links only for admins that is a very bad way of operating. Instead you should have a server variable set when a user is logged in, test for that, and only if it's set then create in PHP the section containing the links. MediaWiki tests for logged in users with if ( $user->isLoggedIn() ) {, see eg user.php. – pbhj yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.