Code to display user's badges?

Waleed

Member
May 28, 2012
68
14
I'm working on a forum addon for RevCMS. For each postbit I want it to display the user's badges, at least 3 of them.

Does anyone know what code(s) I'll need to do so?

Much similar to this:
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
I'm not going to write the code for you, but here's a pretty much step-by-step 'tutorial':
  • do a for each loop on the posts to display them
  • find the user who posted the post in the database
  • get badge list of user
  • split badges into an array
  • echo out img tag
I could go into more detail, but if I did, I may as well write the code for you.
 

St4nley

Member
Apr 13, 2013
469
76
Code:
 $getBadges = mysql_query("SELECT * FROM user_badges WHERE user_id = '" .$member['id'] . "' AND badge_slot >= 1 ORDER BY badge_slot DESC LIMIT 5");
                                     
                                        while ($b = mysql_fetch_assoc($getBadges))
                                        {
                                                echo '<img src="/r63/c_images/album1584/' . $b['badge_id'] .'.gif" style="float: left;">&nbsp;&nbsp;&nbsp;';
 

Users who are viewing this thread

Top