Add class of user role to page? I need to add a class of the user's role to my page. Ive tried the following but it doesn't work, and it seems from the comments its not working for others aswell. 

function THEMENAME_preprocess_page(&amp;$vars) {
  if ($vars['user']) {
    foreach($vars['user']-&gt;roles as $key =&gt; $role){
      $vars['class'][] = 'role-' . drupal_html_class($role);
    }
  }
}


http://grasmash.com/article/drupal-add-current-users-role-body-classes
Use the hook_preprocess_html:

function THEMENAME_preprocess_html(&amp;$vars) {
  foreach($vars['user']-&gt;roles as $role){
    $vars['classes_array'][] = 'role-' . drupal_html_class($role);
  }
}