Posted By

arul20 on 02/21/09


Tagged

administrator drupal admin role


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

panatlantica
variantstudios


Drupal Checking if logged in user is admin


 / Published in: PHP
 

  1. <?php
  2.  
  3. global $user;
  4.  
  5. // Check to see if $user has the administrator role.
  6. if (in_array('administrator', array_values($user->roles))) {
  7.  
  8. // Do something.
  9.  
  10. }
  11.  
  12. ?>

Report this snippet  

You need to login to post a comment.