Posted By

apro2000 on 10/18/10


Tagged

php array drupal user role roles


Versions (?)

Check for multiple values in array


 / Published in: PHP
 

Drupal snippet

  1. $needle = array (1, 'site administrator', 2, 'content manager');
  2.  
  3. $inside = false;
  4.  
  5. foreach ($needle as &$value)
  6. {
  7. if (in_array($value, array_values($user->roles)))
  8. {
  9. $inside = true;
  10. break;
  11. }
  12. }

Report this snippet  

You need to login to post a comment.