Community Central
Community Central
Forums: Index Support Requests Alternative text for logged out users
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Archive
Note: This topic has been unedited for 4921 days. It is considered archived - the discussion is over. Information in this thread may be out of date. Do not add to unless it really needs a response.


Is there a way to get a page to display different text to logged out users than to logged in users? For example, a logged in user would see:

General text section
Text section A
General text section

and a logged out user would see:

General text section
Text section B
General text section

Thanks, Enodoc(Talk) 18:16, December 23, 2011 (UTC)

I don't think is easily possible using built-in MediaWiki functions. There's a good chance you can do it through JavaScript (using the same function a lot of wikis have that echo back username and then doing some sort of regex test to see if the user name is an actual user name or IP address), but honestly even then I'm not convinced it would be 100% effective. --daNASCAT WikiaStaff.png (help forum | blog) 19:07, December 26, 2011 (UTC)
You can use this javascript code to check if the person is logged in:
if (wgUserGroups == null) {
    //code to run when we are logged out
} else {
    // code when logged in
}
That's probably easier than regexing the user name. To swap the messages, you could use 2 CSS classes and then set the correct one visible with the javascript. - Tjcool007 (Talk) 20:55, December 26, 2011 (UTC)