I have selected the Buddylist block |configure, and then selected to exclude the block on all pages except those listed in the box. In the box I put user/me. But when I go to my profile page, the block isn't there? Any advice? tia.

Comments

AppleBag’s picture

Anyone?

cdale’s picture

The drupal 5 version of this module actually does a redirect to user/[uid] so using user/me in the block configuration will not work.

What might work is if you set the visibility to use PHP code, and then enter the following code:


if (arg(0) == 'user' && is_numeric(arg(1)) && empty(arg(2))) {
  return TRUE;
}

AppleBag’s picture

Hi, thanks for helping no but luck, it still shows on every page when I add the code.

cdale’s picture

Sorry about that. There is one small error in the code I gave above.

Try this. Don't forget to include the tags in the block aswell.

if (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) {
  return TRUE;
}
AppleBag’s picture

This is working great, with the exception it is also showing the block on any user's profile page, rather than just my own profile page (my own meaning whichever user is logged in).

Is there a way to tweak it so that the block only shows up on the user's own profile page and nowhere else?

cdale’s picture

Sure. You should be able to do the following:

if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) == $GLOBALS['user']->uid && arg(1) != 0 && is_null(arg(2))) {
  return TRUE;
}

In English, that says the following:

If the first part of the path is 'user', and the second argument is a number, and the second argument is equal to the currently logged in users uid, and it is not an anonymous user, and it is not an edit/files/whatever page for this user, then show this block. :)

Please mark this issue as fixed if this works out for you.

AppleBag’s picture

Status: Active » Fixed

Perfect, thanks a mill. :)

vm’s picture

These nuggets should probably be posted to the handbook ?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.