Show blocks only on user's own profile page
Last modified: April 7, 2007 - 13:10
On profile pages, if the user is viewing his/her own page they see their Private message block, group block, etc. (basically all of their personal blocks), but if they are viewing a DIFFERENT user profile, I do not want them to see those details (as I don't want to see a list of my messages/groups/etc. on someone else's page).
<?php
global $user;
if (arg(0) == 'user' && $user->uid == arg(1)){
return TRUE;
}
else {
return FALSE;
}
?>http://www.example.com/user/uid
http://www.example.com/arg(0)/arg(1)
So basically the block is visible if the viewer's uid is the same as arg(1) meaning the viewer is viewing his/her own profile.
