function commons_reputation_commons_profile_action_links_alter in Drupal Commons 6.2
Implementation of hook_commons_profile_action_links_alter()
File
- modules/
features/ commons_reputation/ commons_reputation.module, line 32
Code
function commons_reputation_commons_profile_action_links_alter(&$links, $account) {
global $user;
// Fetch the user's point total
$points = userpoints_get_current_points($account->uid, 'all');
// Add the user's points
$links['userpoints'] = array(
'title' => t('Points: !points', array(
'!points' => $points,
)),
);
// Fetch the user's badges
// It's possible the account hasn't been fully loaded
if (!isset($account->badges)) {
$edit = array();
user_badges_user('load', $edit, $account);
}
// Move all the badges into a single variable
$badges = '';
foreach ($account->badges as $badge) {
$badges .= theme('user_badge', $badge, $account);
}
// If we have badges to show, add them
if ($badges) {
$links['user_badges'] = array(
'title' => $badges,
'html' => TRUE,
);
}
}