Show Blocks only on user's pages and not on login, edit etc. pages

User login

If we need to display a block in user pages, and not in /user/login or /user/register etc pages, we need to field in some custom php code under the Page specific visibility settings, we select the radio "Show if the following PHP code returns TRUE (PHP-mode, experts only)" and we fill in the following code:

<?
global $user;
if (arg(0) == 'user' && is_numeric(arg(1)) && (arg(2) == NULL) )
{
  return TRUE;
}

else {
  return FALSE;
}
?>

and if we need to display the block in the user's profile page, the code is slightly different:

<?
global $user;
if (arg(0) == 'user' && $user->uid == arg(1) && is_numeric(arg(1)) && (arg(2) == NULL) )
{
  return TRUE;
}

else {
  return FALSE;
}
?>
Tags: 
Drupal 6, Drupal Quick Tips