function user_badges_userweight_page in User Badges 6.2
Same name and namespace in other branches
- 6 user_badges.module \user_badges_userweight_page()
- 7.4 user_badges.module \user_badges_userweight_page()
- 7 user_badges.module \user_badges_userweight_page()
- 7.2 user_badges.module \user_badges_userweight_page()
- 7.3 user_badges.module \user_badges_userweight_page()
Define the page on user/uid/badges.
1 string reference to 'user_badges_userweight_page'
- user_badges_menu in ./
user_badges.module - Implements hook_menu().
File
- ./
user_badges.module, line 545 - @brief User Badges module file
Code
function user_badges_userweight_page($uid) {
global $user;
$account = user_load($uid);
drupal_set_title(t('Badges for %user_name', array(
'%user_name' => $account->name,
)));
// Do we have the right to rearrange badges?
if (variable_get('user_badges_userweight', 0) && ($account->uid == $user->uid || user_access('change badge assignments'))) {
// If the setting allows it and we are the badge owner or somebody with permission, yes.
return drupal_get_form('user_badges_userweight_form', $account);
}
else {
// Otherwise, just list the badges on the page.
$user_badges = user_badges_get_badges($account->uid);
$badges = array();
foreach ((array) $user_badges as $badge) {
$badges[] = theme('user_badge', $badge, $account);
}
if ($badges) {
$badges = array(
theme('item_list', $badges),
);
return theme('user_badge_group', $badges);
}
else {
return t('This user is not currently assigned any badges.');
}
}
}