I changed the existing karma badge images and placed moved them to a more visible place on the profile page (see image below). What I am trying to do (and feel like I am almost there) is display the badge a user has earned on the list of jomsocial users so those that earned badges will stand out more (thus creating more value for earning them). So far I was able to display the badges on the user's friends page, however the badges displaying are the logged in user's badge versus the friend's badge. I am sure it has something to do with the user variable I am calling, but since I am so close, I was hoping you could help me with the final missing piece...
The code I used was this: in templates / layout / friends / list.php
$muser = CFactory::getUser($user->id);
$badge = new CBadge($muser);
$badge = $badge->getBadge();
then:
<?php if($badge->current && $config->get('enable_badges')) : ?><img style="width: 36px;float: left;margin-bottom: -30px;margin-left: 75px;" src="<?php echo $badge->current->image; ?>" alt="<?php echo JText::_('MSH POINTS'); ?>" /> <?php endif; ?>
Thanks for any help :)
Hi, Adam.
I tested your code and it seems to work fine:
prntscr.com/7oh2z9
ID is called correctly and badge data as well.
Hi, Adam.
To be sure display array with print_r - you can see on my printscreen result of this commend.
Hi, Adam.
Do like this:
$muser = CFactory::getUser($user->id);
$badge = new CBadge($muser);
$badge = $badge->getBadge();
print_r($badge);
Hi, Adam.
You should add it only in foreach loop:
prntscr.com/7pgy2d
Your printscreen doesn't show the rest of users on the list. Also add <?php echo $user->id; ?> to see what user ID is displayed.
NOTICE:
I apologize but from tomorrow I leave on holidays and I'll be back on duty at 22 July. Another Support member will guide you further.