Wiki Documentation/Show an info box to logged in users only

From ISLAB/CAISR


Show an info box to logged in users only!

I made a little hack that makes it possible to show some information if your logged in.

one example is: http://islab.hh.se/mediawiki/index.php/Courses

If your logged in it will display an infobox. If you log out it will not show. Note, however, this is not a secure way to hide information (you can edit the page to see what is missing).

The implementation is simple

in: http://islab.hh.se/mediawiki/index.php/MediaWiki:Common.js

if ( !mw.user.anonymous() ) {
mw.util.addCSS( 'div.hidden_not_loggedin{display:inline!important; }' );
} else {
mw.util.addCSS( 'div.hidden_not_loggedin{display:none!important; }' );
}

and in the page it self:

<div class="hidden_not_loggedin">
{{Message|icon=[[Image:Info.png|50px]]|text='''Internal:''' use [[Form:CourseForm]]}}
</div><nowiki/>


Info.png Internal: use Form:CourseForm