Here is a quick way to determine if a user has a specific role:
PHP
1 2 3 4 5 6 7 8 |
<?php // Bring the user object into scope. global $user; // Check to see if $user has the administrator user role. if (in_array('administrator', array_values($user->roles))) { // Do something. } ?> |