diff --git a/sites/all/modules/vote_up_down/vud.module b/sites/all/modules/vote_up_down/vud.module index ed32d30..d987869 100644 --- a/sites/all/modules/vote_up_down/vud.module +++ b/sites/all/modules/vote_up_down/vud.module @@ -94,7 +94,8 @@ function vud_menu() { 'title' => 'Votes', 'page callback' => 'vud_user_votes', 'page arguments' => array(1), - 'access arguments' => array('access vote up/down statistics'), + 'access callback' => 'vud_user_votes_access', + 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, ); @@ -117,11 +118,18 @@ function vud_perm() { } /** + * Menu callback + */ +function vud_user_votes_access($uid) { + $account = user_load($uid); + return (user_access('access vote up/down statistics') && user_view_access($account)); +} + +/** * Menu callback; display all votes for a user. */ function vud_user_votes() { - if ($account = user_load(array('uid' => arg(1), 'status' => 1))) { - if ($account->status || user_access('administer users')) { + if ($account = user_load(arg(1))) { $header = array( array('data' => t('Node')), array('data' => t('Vote')), @@ -145,13 +153,9 @@ function vud_user_votes() { $output .= theme('pager', NULL, 25); return $output; - } - else { - drupal_access_denied(); - } } else { - drupal_not_found(); + return t('An error occurred and the voting details could not be retrieved.'); } }