Skip to content

Instantly share code, notes, and snippets.

@jeremycaldwell
Created August 30, 2013 22:52
Show Gist options
  • Save jeremycaldwell/6395056 to your computer and use it in GitHub Desktop.
Save jeremycaldwell/6395056 to your computer and use it in GitHub Desktop.
Drupal 7 - Role
<?php
global $user;
$approved_roles = array('administrator');
if (is_array($user->roles)) {
if (count(array_intersect($user->roles, $approved_roles)) > 0) {
print 'You are admin';
} else {
print 'You are NOT admin';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment