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

heine’s picture

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

heine’s picture

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

heine’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)