--- notify.module 2008-12-17 17:00:06.000000000 -0500 +++ notify-modified.module 2009-02-02 23:41:05.680371400 -0500 @@ -165,6 +165,19 @@ function notify_perm() { } /** + * Determines whether the user can view notification settings. + */ +function notify_user_access($string, $account = NULL, $reset = FALSE) { + return $account && $account->uid && + ( + // Let users with 'access notify' permission view their own notification settings. + (($GLOBALS['user']->uid == $account->uid) && user_access('access notify')) || + // Users with 'administer notify' permission can view all users' notification settings. + user_access('administer notify') + ); +} + +/** * Implementation of hook_menu(). * * @return array @@ -185,8 +198,8 @@ function notify_menu() { 'title' => 'Notification settings', 'page callback' => 'drupal_get_form', 'page arguments' => array('notify_user_settings_form', 1), - 'access callback' => 'user_access', - 'access arguments' => array('access notify'), + 'access callback' => 'notify_user_access', + 'access arguments' => array('', 1), 'type' => MENU_LOCAL_TASK ); $items['admin/user/user/notify'] = array( @@ -220,7 +233,7 @@ function notify_menu() { */ function notify_user_settings_form(&$form_state, $arg) { global $user; - if ($user->uid != $arg->uid && $user->uid != 1) { + if (!(($user->uid == $arg->uid) && user_access('access notify')) && !user_access('administer notify')) { drupal_access_denied(); return; }