I made so the logged in user have a recap of their last comments/added node on their profile with a view.
As I am making the profile page public, I need to be able to hide those blocks from others authenticated users.

How can I make the block visible to the user for which the profile page is?

1 Answer 1


So I found out :

  • Either you can directly go in view and add a "FILTER CRITERIA" > "(author) User: Current" and it will hide the content for user that are not the current logged in user
  • Or you can go in the block settings, select "Pages on which this PHP code returns TRUE (experts only)" and add in the box <?php global $user; return $user->uid == arg(1); ?> and the block disappear totally if you are not the current user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.