Active
Project:
Buddylist
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Critical
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Mar 2007 at 14:05 UTC
Updated:
19 Jul 2009 at 10:20 UTC
Cant seem to get a buddylist snippet to show a users buddies on their profile.
I found this snippet but it only shows the buddies of the logged in user. How can I show the buddies of the person whos profile you are viewing?
[code]
if ( user_access('view buddy lists') || user_access('administer users') ) {
// if thisuser has friends, show friends
$output = '';
$i = 0;
$cnt = variable_get('buddylist_prof_buddies', 6);
if ($buddies = buddylist_get_buddies($user->uid)) {
foreach(array_keys($buddies) as $buddy) {
$account = user_load(array('uid' => $buddy));
$output .=theme('user_picture', $account);
$listbuddies[] = $account;
$i++;
if ($i > $cnt) {
break;
}
}
$output .= theme('user_list', $listbuddies);
if (count($buddies) > variable_get('buddylist_prof_buddies', 5)) {
$output .= '<div class="more-link">' . l(t('more'), 'buddylist', array('title' => t('View more.'))) . '</div>';
}
print $output;
}
}
[/code]
Comments
Comment #1
Rosamunda commentedI have exactly the same question!
I don´t get why anyone should want to see their very own buddies inside each profile pages!
Just suscribing...
Comment #2
lainwired commentedHave you aver checked out the advanced forum module? It is kinda hard to implement (i recommend using the Bio modules with it if you do). You can add all sorts of user information in the profile as well as user's buddies, user's recent posts.
Comment #3
Rosamunda commentedHi!
Yeah, I´m using that module, with Bio module too.
But it seems that you have to get installed the usernode module to get that block working....!
Comment #4
ChristieLuv commentedHi! Did you use the the Div's that are supposed to go to the top of that code because on this page it shows the code but it includes divs. You might also try it with different themes and see if its the theme thats interfering with it because I tried that code and worked after I switched around themes.
http://drupal.org/node/36501
Comment #5
TheOldGuy223 commentedIs there a quick IF statement I can add to this so that it only shows up if the logged in user is the same as the users profile?
Comment #6
TheOldGuy223 commentedBy the way I figured out how to view the profiles buddy list instead of the logged in users buddy list
You have to replace
if ($buddies = buddylist_get_buddies($user->uid))to
if ($buddies = buddylist_get_buddies($node->uid))I hope that helps some people
Comment #7
Infinitee commentedreplace
if ($buddies = buddylist_get_buddies($user->uid))to
if ($buddies = buddylist_get_buddies($node->uid))This did not work for me using Drupal 5.