One would think that setting Number of buddies and users who've added me to zero at admin/settings/buddylist would make it so zero users show up on the buddy list on users' profile pages. Actually, it causes only one user to show up. I'd like the list to disappear altogether, as I've set up custom blocks using Views to display the buddies of the user whose profile is being viewed.

The problem is in the function buddylist_get_buddylist(). The only thing this function does (as far as I can tell) is display the buddylist on the user's profile page. The function doesn't need to run at all if the buddylist_prof_buddies variable equals zero, so the function should just break in this case:

if (!variable_get('buddylist_prof_buddies', 5)) {
  break;
}

I'm not sure on the syntax here, as I've hardly ever coded in PHP (but I'm learning!).

This is a rather hack-ish way of getting around it I suppose. I'm not sure why the problem exists in the first place.

Comments

IceCreamYou’s picture

Status: Active » Needs review

Never mind my solution in the original post--I solved it a different, better way. The original solution would have stopped Buddylist from listing buddies at all, anywhere, if buddylist_prof_buddies was zero.

This solution works as it should, however: line 464 (part of function buddylist_user) is:

    if ($list = buddylist_get_buddylist($thisuser)) {

But it should read:

    if (($list = buddylist_get_buddylist($thisuser)) && (variable_get('buddylist_prof_buddies', 5))) {

Adding that second condition (variable_get('buddylist_prof_buddies', 5)) tells Buddylist to only print the list of buddies on the profile page if a non-zero number of buddies is supposed to be allowed.

This still doesn't solve the problem of why this issue occurs, but it at least stops the effects from showing up.

Rosamunda’s picture

It worked for me too. THANKS!

el_reverend’s picture

Great little modification combined with moving the friends listing to a tab. This should be included in a new version asap.