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
<?php
global $user;
// Check to see if $user has the administrator user role.
if (in_array('administrator', array_values($user->roles))) {
// Do something.
}
?>
also i have this code but i think this is only checking one of the roles, so it checks for either A or B
<?php
global $user;
$check = array_intersect(array('moderator', 'administrator'), array_values($user->roles));
if (empty($check) ? FALSE : TRUE) {
// is admin
} else {
// is not admin
}
?>