block restrict depending on role
// Check to see if $user has the administrator role.
  if (in_array('administrator', array_values($user-&gt;roles))) {
    // Do something.
  }


Replace "administrator" with the role name you want to check.

EDIT:

If you want to check for role id's use below code.

global $user;
$role_ids = array_keys($user-&gt;roles);
if (in_array(6, $role_ids)) {
  // Do something
}


In your case

&lt;?php
global $user;
$role_ids = array_keys($user-&gt;roles);
if (user_access('access administration pages') || (in_array(6, $role_ids))) {
  return FALSE;
} else {
  return TRUE;
}
?&gt;