Skip to content

Instantly share code, notes, and snippets.

@napoler
Forked from brandonratz/User has Role
Last active August 28, 2015 19:05
Show Gist options
  • Save napoler/677a96ea87143bf489b2 to your computer and use it in GitHub Desktop.
Save napoler/677a96ea87143bf489b2 to your computer and use it in GitHub Desktop.
Drupal
<?php
// Load the currently logged in user.
global $user;
// Check if the user has the 'editor' role.
if (in_array('editor', $user->roles)) {
// do fancy stuff
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment