Download & Extend

Block visibility on user pages user/1, user/2 but not user/rsvp/1 or user/rsvp/2, etc

Project:Block Page Visibility
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I want to show a block on each users' page but not the subpages

so for example for user 1, user 2, and user 3 I want to show a block but I don't want to show it on user/1/rsvp, etc

I thought I could just do
user
user/*/

but neither of these work

Comments

#1

add this to your block visibility. with php enabled

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

#2

I may be way off topic here, but I hope you can help.

Can I use something similar to control comments visibility?

I have a book page which contains a story (actually a writing assignment), visible to all users.

Comments are enabled.

Each registered user can post his assignment into a comment.

But I don't want other users to be able to see all comments. Each user should only be able to see his own comments.

It is a way of submitting schoolwork, without other students seeing each other's work.

Your php suggestion looks similar to what I want to do.

Any ideas?

Thanks so much, and apologies for butting in to this topic.

#3

Try this:
Show block only on:
user/me
user/*0
user/*1
user/*2
user/*3
user/*4
user/*5
user/*6
user/*7
user/*8
user/*9

nobody click here