? .cvsignore
? clean_up_my_access_checks.patch
? fix_mypoints_access.patch
Index: userpoints.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/userpoints.module,v
retrieving revision 1.68.2.3
diff -u -p -r1.68.2.3 userpoints.module
--- userpoints.module	5 Aug 2010 12:06:30 -0000	1.68.2.3
+++ userpoints.module	9 Aug 2010 07:43:58 -0000
@@ -164,11 +164,13 @@ function userpoints_menu() {
       'type' => MENU_NORMAL_ITEM,
   );
 
-  $items['myuserpoints'] = array(
+  $items['myuserpoints/%user_uid_only_optional'] = array(
       'title' => 'My !points',
       'title arguments' => userpoints_translation(),
       'page callback' => 'userpoints_list_my_userpoints',
+      'page arguments' => array(1),
       'access callback' => 'userpoints_access_my_points',
+      'access arguments' => array(1),
       'file' => 'userpoints.pages.inc',
       'type' => MENU_NORMAL_ITEM,
       'menu_name' => 'user-menu',
@@ -183,10 +185,10 @@ function userpoints_menu() {
  *   TRUE if user has permissions to view userpoints and if the user is logged
  *   in.
  */
-function userpoints_access_my_points() {
+function userpoints_access_my_points($uid = NULL) {
   global $user;
-  if ($user->uid === 1 || user_access('administer userpoints')) {
-    return TRUE;
+  if ($user->uid != $uid) {
+    return user_access('administer userpoints');
   }
   return (user_access('view userpoints') && user_is_logged_in()) || user_access('view own userpoints');
 }
@@ -685,7 +687,7 @@ function userpoints_user_view($account, 
   global $user;
   if (user_access('view userpoints') || (user_access('view own userpoints') && $user->uid == $account->uid )) {
     $details = NULL;
-    if (userpoints_access_my_points ()) {
+    if (userpoints_access_my_points($account->uid)) {
       $details .= l(t('View'), 'myuserpoints/' . $account->uid, array('attributes' => array('title' => t('View detailed transactions'))));
     }
     if (user_access('administer userpoints')) {
Index: userpoints.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/Attic/userpoints.pages.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 userpoints.pages.inc
--- userpoints.pages.inc	30 Jul 2010 11:20:22 -0000	1.1.2.1
+++ userpoints.pages.inc	9 Aug 2010 07:43:58 -0000
@@ -13,34 +13,13 @@
  * @param $uid
  *   User id, defaults to current user.
  */
-function userpoints_list_my_userpoints($uid = NULL) {
+function userpoints_list_my_userpoints($uid) {
   $overall_total = 0;
   $unapproved_total = 0;
   $approved_total = 0;
 
-  global $user;
-
-  // User which are displaying points for.
-  if ($uid) {
-    if ($uid != $user->uid && !user_access('administer userpoints')) {
-      // If not the same as logged in user.
-      drupal_access_denied();
-      return;
-    }
-  }
-  else {
-    // Default to currently logged in user.
-    $uid = $user->uid;
-  }
   $point_user = user_load($uid);
 
-  // Check permissions.
-  if (!user_access('view userpoints') && !user_access('view own userpoints')) {
-    // User has no access to view points.
-    drupal_access_denied();
-    return;
-  }
-
   $title = t('!Points for @username', userpoints_translation() + array('@username' => $point_user->name));
   drupal_set_title($title);
 
