Show users buddies on their profile
j0k3z - March 26, 2007 - 14:05
| Project: | Buddylist |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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]
<?php
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]

#1
I 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...
#2
Have 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.
#3
Hi!
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....!
#4
Hi! 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
#5
Is 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?
#6
By 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
#7
replace
if ($buddies = buddylist_get_buddies($user->uid))to
if ($buddies = buddylist_get_buddies($node->uid))This did not work for me using Drupal 5.