Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Created December 15, 2010 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrchrisadams/741955 to your computer and use it in GitHub Desktop.
Save mrchrisadams/741955 to your computer and use it in GitHub Desktop.
diff --git a/sites/all/modules/contrib/userpoints/userpoints.module b/sites/all/modules/contrib/userpoints/userpoints.module
index 412bce7..3654fca 100644
--- a/sites/all/modules/contrib/userpoints/userpoints.module
+++ b/sites/all/modules/contrib/userpoints/userpoints.module
@@ -175,12 +175,15 @@ function userpoints_menu() {
*/
function userpoints_access_my_points() {
global $user;
- if ($user->uid === 1 || user_access('USERPOINTS_PERM_ADMIN')) {
- return TRUE;
+
+ if ($user->uid > 0){
+ if(!user_access(USERPOINTS_PERM_VIEW || user_access(USERPOINTS_PERM_VIEW_OWN))) {
+ return true;
+ }
+ }
+ else {
+ return false;
}
- return ( _userpoints_user_exists($user->uid) &&
- ((user_access(USERPOINTS_PERM_VIEW) && user_is_logged_in()) || user_access(USERPOINTS_PERM_VIEW_OWN))
- );
}
/**
@@ -1671,31 +1674,12 @@ function userpoints_list_my_userpoints() {
// User which are displaying points for
$uid = (int)arg(1);
- if ($uid) {
- if ($uid != $user->uid) {
- // If not the same as logged in user
- drupal_access_denied();
- return;
- }
- }
- else {
+ if (!$uid) {
// Default to currently logged in user
$uid = $user->uid;
}
$point_user = user_load(array('uid' => $uid));
- // Check permissions
- if(!user_access(USERPOINTS_PERM_VIEW)) {
- // User has no access to view points
- drupal_access_denied();
- return;
- }
-
- if (!user_access(USERPOINTS_PERM_VIEW_OWN)) {
- // User has no access to view own points
- drupal_access_denied();
- return;
- }
$title = t('!Points for ', userpoints_translation()) . check_plain($point_user->name);
drupal_set_title($title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment