How to display a buddy list
Display a list of buddies snippet
PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.
Description
This php snippet displays a list of buddies and links to their profiles to users who have View Buddy List permissions.
Dependencies: profile.module. Buddylist.module
Usage
- For use in your user profile page override
- Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
<?php
if (user_access('view buddy lists') || user_access('administer users')) {
// If this user has friends, show friends
$output = '';
$i = 0;
$cnt = variable_get('buddylist_prof_buddies', 5);
if ($buddies = buddylist_get_buddies($account->uid)) {
foreach (array_keys($buddies) as $buddy_uid) {
$listbuddies[] = user_load(array('uid' => $buddy_uid));
$i++;
if ($i > $cnt) {
break;
}
}
$output .= t('Buddies');
$output .= theme('user_list', $listbuddies);
$output .= '
';
