--- userpoints_top_contributors.module.org 2008-04-07 05:05:14.000000000 +0800 +++ userpoints_top_contributors.module 2008-12-01 00:52:43.000000000 +0800 @@ -221,27 +221,30 @@ } function userpoints_top_contributors_user($op, &$edit, &$account, $category = '') { + global $user; switch ($op) { case 'view': - // Get the points for the user - $lifetime_points = number_format(userpoints_get_max_points($account->uid, 'all')); - $current_points = number_format(userpoints_get_current_points($account->uid, 'all')); - - if (user_access(USERPOINTS_PERM_ADMIN)) { - $current_points = $current_points .'  '. l('(details)', 'myuserpoints/'. $account->uid, array('title' => t('Details'))) .'  '. l('(manage)', 'admin/user/userpoints/add/'. $account->uid, array('title' => t('Add points'))); - } - - $disp_points[] = array( - 'title' => t('Lifetime'), - 'value' => $lifetime_points, - ); - - $disp_points[] = array( - 'title' => t('Current'), - 'value' => $current_points, - ); - - return array(t('!Points', userpoints_translation()) => $disp_points); + if (user_access(USERPOINTS_PERM_VIEW) || (user_access(USERPOINTS_PERM_VIEW_OWN) && $user->uid == $account->uid)) { + // Get the points for the user + $lifetime_points = number_format(userpoints_get_max_points($account->uid, 'all')); + $current_points = number_format(userpoints_get_current_points($account->uid, 'all')); + + if (user_access(USERPOINTS_PERM_ADMIN)) { + $current_points = $current_points .'  '. l('(details)', 'myuserpoints/'. $account->uid, array('title' => t('Details'))) .'  '. l('(manage)', 'admin/user/userpoints/add/'. $account->uid, array('title' => t('Add points'))); + } + + $disp_points[] = array( + 'title' => t('Lifetime'), + 'value' => $lifetime_points, + ); + + $disp_points[] = array( + 'title' => t('Current'), + 'value' => $current_points, + ); + + return array(t('!Points', userpoints_translation()) => $disp_points); + } break; } }