Skip to content

Instantly share code, notes, and snippets.

@raynimmo
Created September 11, 2013 16:44
Show Gist options
  • Save raynimmo/12e7bdb08893ab752c88 to your computer and use it in GitHub Desktop.
Save raynimmo/12e7bdb08893ab752c88 to your computer and use it in GitHub Desktop.
Drupal: opting out of actions based on current users role. Can be used in page.tpl.php
global $user;
if($user->roles[3] || $user->roles[4]){
//dont track admins or moderators
}
if($user->roles[0] || $user->roles[1] || $user->roles[DRUPAL_ANONYMOUS_RID] || user_is_anonymous()){
//track anonymous or regular users
} // endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment