I have made a block and only want it to appear in the 'my account' page [ http://!!!.com/user/ ] so I use the page visibility settings;
Show on only the listed pages - user/*
but this means it shows up in all pages prefixed with user/ , such as user/regiter and user/edit.
How can i make a block visible on just the user's 'my account' page - 'user/x ' - where x is id of user, but not 'user/x/edit' or anywhere else.
any help appreciated.
cheers

Comments

cog.rusty’s picture

If the paths and wildcards don't cover you, then insert some php code for visibility.

global $user;
if (arg(0)=='user' && arg(1)==$user->uid && is_null(arg(2))) {return TRUE;}
else {return FALSE;}

-----

(Edited to correct an error)

.-_-.’s picture

i see, so with the above code, it will only return true is arg(1) is 'user' and arg(2) is empty - brilliant thankyou