Forum:How to make a section only visible to anonymous users?

Hello! I need to put a new div section with a specific message on the main page of Mass Effect Answers wiki. The problem is, I need it to only show itself to anonymous users. Can anyone say, is this possible, and how to do it? Mitranim 08:54, August 1, 2011 (UTC)


 * You could make the div hide as default with css, and then use js to display it if the user rights match those of an anon. I think this code should work:
 * Tag the div with a class of 'anonmessage'.
 * Add the following code to wikia.css:

.anonmessage { display: none }
 * Add the following code to wikia.js:

function AnonMessage { if(window.wgUserGroups && (wgUserGroups.indexOf("null")) != -1) { $('.anonmessage').css({"display": 'inline'}); } } $(AnonMessage);




 * Close, but wgUserGroups isn't a string, so that'll break. You'll want this:

 function AnonMessage { if(wgUserGroups == null) { $('.anonmessage').css('display', 'inline'); } } addOnloadHook(AnonMessage)
 * It may have problems displaying properly because it's inline, but that can be fixed by changing it to block.