By apt94jesse on
The code below is being used in a custom profile page, I am trying to display both the avatar and name of the buddies in the buddylist module.
<!-- BUDDY LIST -->
<div class="profileblock">
<?php
/* if you want to change which category you grab just change the following line */
$i_want_all_fields_under_this_category = 'Buddy List';
$output = '';
foreach ($fields as $category => $items) {
if($category == $i_want_all_fields_under_this_category) {
$output .= '<h2 class="title">'. $category .'</h2>';
$output .= '<p>';
foreach ($items as $item) {
/*for control over which 'titles' you grab you can insert another conditional if-statement here */
if (isset($item['title'])) {
/* $output .= '<p class="'. $item['class'] .'">'. $item['title'] .'</p>';*/
}
$output .= '<p>'. $item['value'] .'</p>';
}
$output .= '</p>';
}
}
if ( user_access('view buddy lists') || user_access('administer users') ) {
// if thisuser has friends, show friends
$outputa = '';
$i = 0;
$cnt = variable_get('buddylist_prof_buddies', 8);
if ($buddies = buddylist_get_buddies($user->uid)) {
foreach(array_keys($buddies) as $buddy) {
$account = user_load(array('uid' => $buddy));
$listbuddies[] = $account;
?>
<a href="http://www.combatfusion.com/newdrupal/?q=user/<? print $buddy ?>"><img border="1" height="65" width="65" src="http://combatfusion.com/newdrupal/<? print $account->picture?>"></a>
<?
$i++;
if ($i > $cnt) {
$outputa .= '<div class="more-link">' . l(t('view all connects'), 'buddylist', array('title' => t('View more.'))) . '</div>';
break;
}
}
print $outputa;
}
}
?>
<?php print $account->uid ?>
<!-- END BUDDY LIST CODE -->
Please excuse this terribly ugly code as I am a novice php guy trying to make this work.
My problem: I cannot figure out the variable to print the buddy's name!!! $buddy simply calls the id number so that I can enter it into the img tag and call the avatar, however I am at a loss to decipher a variable to call the simple name of a buddy.
Any help or direction would be appreciated.
-Jesse
Comments
figured it out
That works fine. Any php experts want to elaborate as to why this works for the benefit of us novices?
-Jesse
tracking
tracking
http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.
don't
don't track this, it's for drupal 4.7 and an antiquated version of the buddylist module. Get 5.x (or 6 if you don't need views). I'm sure they've made drastic improvements.
Buddylist returns usernode. Can I change that?
Buddylist and User relationships returns the usernode from a view. and I can only filter on the items in the usernode.
I setup nodeprofile and have a lonley node called general_profile where I keep the the profile information that I want to display.
how do I access general_profile based on the uid i can extract from the usernode returned?
I also want to filter on the variables that are present in general_profile.
I am a little frustrated and admittedly over my head.
http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.