It's better when it's simple

User Tools

Site Tools


Permission Styles Plugin

Compatible with DokuWiki

No compatibility info given!

plugin Include different stylesheets depending on the groups a user is in.

Last updated on

The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on Recommended are public repository hosts like GitHub, GitLab or Bitbucket.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Security warning (please read plugin security guidelines): Hiding parts of a DokuWiki page is not supported by the core. Most attempts to introduce ACL control for parts of a page will leak information through RSS feed, search or other core functionality.

Tagged with acl, groups, style, users

If you want to hide some elements from users which are not in the admin group, if you want different backgrounds for different company departments—this plugin is for you. Just install it and put CSS files into the lib/styles/ folder that follow the convention of group_groupname.css, for example group_admin.css .

To Do

  • Cache the available style files to avoid too many file_exist calls.
  • User-Specific stylesheets?

Plugin Code

 * Permission Styles: Include different stylesheets depending on the groups a user is in.
 * @author     Gabriel Birke <>
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
class action_plugin_permissionstyles extends DokuWiki_Action_Plugin {
   * return some info
  function getInfo(){
    return array(
     'author' => 'Gabriel Birke',
     'email'  => '<',
     'date'   => '2008-01-30',
     'name'   => 'Action Plugin Permission Styles',
     'desc'   => 'Include different stylesheets depending on the groups a user is in.',
     'url'    => '',
   * Register its handlers with the DokuWiki's event controller
  function register(Doku_Event_Handler $controller) {
    $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE',  $this, '_includeStylesheets');
   * Look for group_*.css files in lib/styles/. 
   * Include the stylesheets for the group where the user is a member.
  function _includeStylesheets(&$event, $param) {
    global $conf;
    $auth_class = 'auth_'.$conf['authtype'];
    $auth = new $auth_class();
    $userdata = $auth->getUserData($_SERVER['REMOTE_USER']);
    if(empty($userdata) || empty($userdata['grps']))
    foreach($userdata['grps'] as $group)
      $file = 'lib/styles/group_'.$group.'.css';
        $event->data['link'][] = array (
            'rel' => 'stylesheet',
            'type' => 'text/css',
            'href' => DOKU_BASE.$file
plugin/permissionstyles.txt · Last modified: 2013-11-02 02:28 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki