Restrict administrator users from seeing blocks I am using Drupal 6. I placed a JavaScript snippet in a block required by a third-party chat service I have on site.
Now, this block is by default displayed on my administrative pages, which is annoying. Is it possible to restrict the admin role from seeing this block?

I tried this kind of snippet but it doesn't work.

global $user;
if (($user-&gt;role) == 'anonymous') {
  return TRUE;
}
else {
  return FALSE;
}


?>
If you don't want the block displayed on admin PAGES, eg, www.yourhost.com/admin/HERE, you can go into the block admin pages and restrict the block to be displayed on all pages EXCEPT admin/*.

However, if you don't want your "root" or "superuser" to see the blocks on any page, you can do what @BetaRide has suggested above in the PHP area of the admin page.

In the same vein, if you don't want anyone with an admin role to see the block, you can do something like this:

global $user;
if ($user-&gt;uid==1 || in_array('admin users', array_values($user-&gt;roles))) {
  return FALSE;
} else {
  return TRUE;
}


Of course, here you have to make sure you have a role called admin users so that might be different on your system.

If you don't want to add a role, you could use permissions and do it like this:

if (user_access('access administration pages')) {
  return FALSE;
} else {
  return TRUE;
}


which would display the block only to those users who could NOT access the admin pages.