[Mediawiki-l] different texts for different users

Krinkle krinklemail at gmail.com
Wed Apr 6 14:41:08 UTC 2011

Platonides wrote:
> Scheid, Bernhard wrote:
>> Is there any method (Magic Word, etc.) to determine the status/ 
>> usergroup of the user viewing the page?
>> Something like "{{#if: sysop |... }}" ?
>> I would need this in a template that produces different texts for  
>> different users.
>> I tried Extension:ConditionalShow but it did not work (probably not  
>> compatible with MW 1.16?)
>> Thx
>> Bernhard
> Not out of the box. You would need an extension or javascript to do  
> such
> switch.

As of 1.18 usergroup-specific site wide resources are / can be loaded.

eg. MediaWiki:Sysop.css / MediaWiki:Sysop.js

What you could have:

== Template:MsgForUser ==
<div class="msgforuser msgforuser-{{lc:{{{group|user}}}}}">
{{{msg|Hello this message is for a specific user-group only}}}

== MediaWiki:Common.css ==
.msgforuser { display: none; }

== MediaWiki:User.css ==
.msgforuser.msgforuser-user { display: block; }

== MediaWiki:Sysop.css ==
.msgforuser.msgforuser-sysop { display: block; }

== My awesome page ==
Welcome {{MsgForUser | group=sysop | msg=master }}, how are you today ?

Which will display "Welcome, how are you today?" or "Welcome master,
how are you today?" depending on the membership of the user.

Right out of the box support for content for registered-users only,
or sysop, or any other usergroup you may have.

Only takes a few css settings, no JS dependency either.

The only catch is that it's not in 1.16 or 1.17


More information about the MediaWiki-l mailing list