Description
The User Badges module allows each user to be assigned "badges," displayed as a series of iconic images. A common use would be to display the badges along with the user's information within forums, comments, or node postings. These badges can be assigned individually by the administrator or attached to a role so that, for example, all users in the "admin" role will show the "Administrator" badge which could display as any graphic.
Any badge can optionally be associated to a URL that links the image to a description page. This URL has token support. If a user has more than one badge, there is also a mechanism that allows administrators to only show the highest level badges.
You can also set a special badge for blocked users and even override their role badges with this one.
User Badges can be used as a way to establish trust (in the same way as eBay's star graphics) or as an incentive for users. They can also be a quick way to identify moderators, administrators, or anyone with a given role.
Limitation
The badge image library is not compatible with the "private" file download method, but the module can still be used; just ignore the Images tab on the badge admin screen.
Dependencies
In order to upload images via the user interface, user badges depends on:
Upload
Image
User Product Badges (sub-module) requires:
ecommerce
Configuration
The module will be found in the "User interface" section of the Modules configuration page.
Once the module is activated, go to Administer >> Configuration >> People >> Badges (admin/config/people/user_badges). Here you'll find tabbed sections for User Badges.
- List - Lists all current badges and allows you to edit them.
- Add - Add a new badge.
- Images - The badge image library. If you already have images available, you can ignore this, but if you need a way to upload images for badges, this is the place.
- Roles - Here you can associate a badge with a given role so that all users with that role will display the selected badge.
- Settings - where you can set the global settings for the module.
- Products - This tab is provided by the module User Product Badges. It allows you to associate badges with products for the ecommerce module.
Permissions
The module provides three permissions:
- Users with "access user badges" permission can see the badges. (Requires theme change, see below.)
- Users with the "manage badges" permission will have access to the administration pages for the module.
- Users with the "change badge assignments" permission will be shown a 'Badges' tab when visiting user profiles. This is the place to manually assign badges to users.
- Users with the "change own badge assignments" permission will be shown a 'Badges' tab when visiting their account page.
- Users in roles with the "suppress badges in user profile" permission, will not show their badges on the user profile page.
Display badges
To display user badges in your theme use:
If you want to something fancier than what the module does, all badges for the user are in the user object at $user->badges_all, and the limited list is at $user->badges. To theme a badge image, use theme('user_badge', $variables), where $variables is a keyed array with 'badge' pointing to the badge object and 'account' pointing to the appropriate user object.