Badges on nodes, comments, forums, etc.

nickfitz - July 30, 2006 - 14:21
Project:User Badges
Version:4.7.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

#1

Heine - August 2, 2006 - 14:09

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

Heine - August 2, 2006 - 14:17

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

Heine - August 3, 2006 - 06:49
Status:active» fixed

#4

Anonymous - August 17, 2006 - 07:00
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.