Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Displaying badges...

11 years 3 months ago
  • Adam's Avatar
    Topic Author
  • Adam
  • Offline
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 2
Licenses:
JomSocial Active

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 :)


Attachment friendbadges.PNG not found

Attachments:
11 years 3 months ago
Licenses:

Hi, Adam.

I tested your code and it seems to work fine: prntscr.com/7oh2z9
ID is called correctly and badge data as well.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
11 years 3 months ago
  • Adam's Avatar
    Topic Author
  • Adam
  • Offline
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 2
Licenses:
JomSocial Active

Michal,

As you can see in the previous post's image, it's displaying my badge on all the other profiles, so somehow, it's using the cuser properties instead of the other user's badge info...

Adam

11 years 3 months ago
Licenses:

Hi, Adam.

To be sure display array with print_r - you can see on my printscreen result of this commend.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
11 years 3 months ago
  • Adam's Avatar
    Topic Author
  • Adam
  • Offline
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 2
Licenses:
JomSocial Active

Michal,

I am not sure what I am doing wrong at this point. How were you able to display the php arrays like in the pic? did you add print_r in the lists.php page itself?

Thanks,

Adam

11 years 3 months ago
Licenses:

Hi, Adam.

Do like this:

$muser = CFactory::getUser($user->id);
$badge = new CBadge($muser);
$badge = $badge->getBadge();
print_r($badge);

This will display array values.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
11 years 3 months ago
  • Adam's Avatar
    Topic Author
  • Adam
  • Offline
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 2
Licenses:
JomSocial Active

Michal,

Thank you for walking me through this :)

Here is the attached screenshot after adding the additional code. I added it at the beginning of the page and line item...

Adam

Attachment badgeprint.PNG not found

Attachments:
11 years 3 months ago
Licenses:

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.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW