Drupal 7 check logged in user has both roles in tpl file? I want to print in a page--node--17.tpl.php a code to check for roles from the logged in user and then determine what should be shown, so basically a user must have BOTH roles A and C and if they do i print xxx
If they have roles A and B i write yyy
if they have roles B and C i print zzz

So the code below can check for one role, but how do i do both.. its important that BOTH roles need to be there, a user with just one of the roles will not qualify.

thank u

&lt;?php
  global $user;
  // Check to see if $user has the administrator user role.
  if (in_array('administrator', array_values($user-&gt;roles))) {
    // Do something.
  }
?&gt;


also i have this code but i think this is only checking one of the roles, so it checks for either A or B

&lt;?php
global $user;
$check = array_intersect(array('moderator', 'administrator'), array_values($user-&gt;roles));
    if (empty($check) ? FALSE : TRUE) {
    // is admin
    } else {
    // is not admin
    }
?&gt;
It would be simple as:

global $user;

if (in_array('administrator', array_values($user-&gt;roles)) &amp;&amp;  in_array('moderator', array_values($user-&gt;roles))) {
    // is admin
} else {
    // is not admin
}