Drupal 7

$GLOBALS['user']->roles;
 or 
global $user; 
$check = array_intersect(array('authenticated user', 'administrator'), array_values($user->roles)); 

if (empty($check) ? FALSE : TRUE) { 
	// is admin
} else {
 	// is not admin 
} 

 

Submitted by : admin
on Thu, 07/26/2018 - 22:08