commons_reputation.module in Drupal Commons 6.2
File
modules/features/commons_reputation/commons_reputation.module
View source
<?php
include_once 'commons_reputation.features.inc';
function commons_reputation_views_pre_view(&$view, &$display_id, &$args) {
switch ($view->name) {
case 'most_active_users':
if (user_access('view userpoints')) {
$view->display_handler
->override_option('footer', l(t('View all users'), 'userpoints'));
}
break;
}
}
function commons_reputation_enable() {
if (module_exists('facebook_status')) {
drupal_install_modules(array(
'fbss_userpoints',
));
}
}
function commons_reputation_commons_profile_action_links_alter(&$links, $account) {
global $user;
$points = userpoints_get_current_points($account->uid, 'all');
$links['userpoints'] = array(
'title' => t('Points: !points', array(
'!points' => $points,
)),
);
if (!isset($account->badges)) {
$edit = array();
user_badges_user('load', $edit, $account);
}
$badges = '';
foreach ($account->badges as $badge) {
$badges .= theme('user_badge', $badge, $account);
}
if ($badges) {
$links['user_badges'] = array(
'title' => $badges,
'html' => TRUE,
);
}
}