Download & Extend

Badges on nodes, comments, forums, etc.

Project:User Badges
Version:4.7.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I am looking to have badges similar to the site:
http://www.gotfrag.com/cs/story/33702/?cpage=1

If you scroll down you will notice that the users that have the "Prime" membership, get a "P" next to their name when they post. I would a similar thing on my site. Any suggestions on the code to use, and where I should put it?

Thanks,
Nick

Comments

#1

Any suggestions on the code to use, and where I should put it?

$uid))) will give you access to the badges via $account->badges[], indexed on badge id (so if you know what id the 'p' has you can use that.

- A faster alternative is user_badges_get_badges($uid) that gives you an array of badges for $uid.
- Both user_badges_for_uid and user_badges_for_user return an html representation of all badges

You can theme badges via theme('user_badge', $badge).

#2

let's try that again

Any suggestions on the code to use, and where I should put it?

.

- A fully loaded user object ($account = user_load(array('uid' => $uid))) will give you access to the badges via $account->badges[], indexed on badge id (so if you know what id the 'p' has you can use that.

- A faster alternative is user_badges_get_badges($uid) that gives you an array of badges for $uid.
- Both user_badges_for_uid and user_badges_for_user return an html representation of all badges

You can theme badges via theme('user_badge', $badge).

#3

Status:active» fixed

#4

Status:fixed» closed (fixed)