function user_badges_for_user in User Badges 6
Same name and namespace in other branches
- 5 user_badges.module \user_badges_for_user()
- 6.2 user_badges.module \user_badges_for_user()
- 7 user_badges.module \user_badges_for_user()
- 7.2 user_badges.module \user_badges_for_user()
- 7.3 user_badges.module \user_badges_for_user()
Get all user badges for a user.
Parameters
$load is array defining criteria for user_load().: The most common use will be: user_badges_for_user(array('uid'=>123));
Return value
string containing HTML representation of user badges for given user.
1 call to user_badges_for_user()
- user_badges_block_view in ./
user_badges.module - Function for user_badges_block(op = 'view').
File
- ./
user_badges.module, line 1026 - @brief User Badges module file
Code
function user_badges_for_user($load, $list = FALSE) {
// @TODO: cache the results to minimize queries.
$account = user_load($load);
foreach ((array) $account->badges as $badge) {
$badges[] = theme('user_badge', $badge, $account);
}
if ($list) {
$badges = array(
theme('item_list', $badges),
);
}
if ($badges) {
return theme('user_badge_group', $badges);
}
else {
// Do we have a "no badges" message?
if ($nobadges = variable_get('user_badges_nobadges', '')) {
$nobadges = '<div class="user_badges_no_badges">' . filter_xss_admin(t($nobadges)) . '</div>';
return theme('user_badge_group', array(
$nobadges,
));
}
else {
return FALSE;
}
}
}