By Steve Blaze on
I am using the code below in my user_profile.tpl.php template but I can not get the pictures to show up with the name. Is there anyway to do this and have the picture and name show up in a table format? Where you can adjust amount of colums and rows and table width? The current code does actually work but I don't want it in bulleted list format, I want it in a table. No one has seemed to figure this one out. Using 4.7.3 Example: CLICK HERE
<?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', 5);
if ($buddies = buddylist_get_buddies($user->uid)) {
foreach(array_keys($buddies) as $buddy) {
$account = user_load(array('uid' => $buddy));
$listbuddies[] = $account;
$i++;
if ($i > $cnt) {
break;
}
}
$output .= t('Buddies');
$output .= theme('user_list', $listbuddies);
$output .= '<br />';
if (count($buddies) > variable_get('buddylist_prof_buddies', 5)) {
$output .= '<div class="more-link">' . l(t('more'), 'buddylist', array('title' => t('View more.'))) . '</div>';
}
$sql = 'SELECT b.uid, u.name FROM {buddylist} b INNER JOIN {users} u ON b.uid = u.uid WHERE b.buddy = %d ORDER BY u.access DESC';
$result = db_query_range($sql, $user->uid, 0, $cnt);
while ($row = db_fetch_object($result)) {
$listbuddiesof[$row->uid] = $row;
}
$output .= t('Buddies of');
if ($listbuddiesof) {
$output .= theme('user_list', $listbuddiesof);
}
if (count($sql) > variable_get('buddylist_prof_buddies', 5)) {
$output .= '<div class="more-link">'. l(t('more'), 'buddylist/'. $user->uid .'/buddiesof', array('title' => t('View more.'))) .'</div>';
}
print $output;
}
}
?>
Comments
Buddylist and Views
Buddylist and Views integration is imminent. That should make these types of things much easier. Stay tuned.
---
www.whatwoulddrupaldo.org