[Mediawiki-l] Permission-Specific Content.

Graeme Worthy graeme at sxip.com
Thu Mar 2 22:30:25 UTC 2006

Here's a litte howto I wrote but I'd like some feedback on it.
I'm not sure if exposing the user object like this presents a big  
hole, and i should instead try a different way of presenting these  

Any thoughts?

= Adding user permissions-specific content in mediawiki. =

The way that templates are used in media wiki does not automatically  
enable user-permission-modifiable content to be specified in the  

you have to let it access the user object.

in the default template, after

function execute( ){


global $wgUser;

and all of a sudden you have access to all the properties.

so now you can do fun stuff like

     <?php if (!$wgUser->isAllowed('edit') ): ?>

     [the edit controls]

     <?php endif ?>

     <?php if ( $wgUser->isAnon() ): ?>

     anonymous users prohibited from viewing this page

     <?php else ?>

     [the page]

     <?php endif; ?>

More information about the MediaWiki-l mailing list