Drupal Hide Block from Admin

Have you every wanted to hide ad blocks or some other content in Drupal when you're logged in? To do so, you will need to enter this code block into the "Show if the following PHP code returns TRUE (PHP-mode, experts only)" section under Page specific visibility settings.

  1. <?php
  2. global $user;
  3. if ($user->uid != 1 && $user->uid !=3)
  4. return TRUE;
  5. ?>

The part that you would be concerned with is after the 'if.' The first user create has a uid of 1. I also don't want to show this block to my other user account - uid 3, so I've added it in. If you only want to not display this block for the uid 1 user, the use the following code.

  1. <?php
  2. global $user;
  3. if ($user->uid != 1)
  4. return TRUE;
  5. ?>

I hope you find this helpful!

I want to hide blocks for

I want to hide blocks for user 1 & 3 along with following pages:

user/register
user/password
contact

Please help!

Hiding blocks

That's a good method. If you are using the "Show on every page except the listed pages" option you could include admin/* to hide blocks from admin pages.