Can't get rid of buddy list on profile

IceCreamYou - March 1, 2008 - 05:23
Project:Buddylist
Version:5.x-1.1-beta
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

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.

#1

IceCreamYou - March 2, 2008 - 00:47
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.

#2

Rosamunda - March 8, 2008 - 21:37

It worked for me too. THANKS!

#3

el_reverend - January 6, 2009 - 00:08

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

 
 

Drupal is a registered trademark of Dries Buytaert.