Notification tab in profile also visible for other users
Militopedia - December 31, 2008 - 15:42
| Project: | Notify |
| Version: | 6.x-1.0 |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | matt2000 |
| Status: | closed |
Description
Hello,
I noticed that if a user visits another user's profile the tab "notification" is visible and if one clicks on it the "no access" page appears (but with an error: the site's icon is repeated a 2nd time at the bottom; I am using the Nitobe theme).
I think the notification tab should only be visible if you are on your own profile page but not if you are on other user's profile pages.
Am I right?
Cheers,
Roger

#1
I have similar issues...
As an administrator, I've set up notifications for a particular user (the client). As an admin, when I go to access this user's notifications, I get an "Access Denied" message, and the entire web page is repeated an additional time below the original web page. Very weird.
#2
I needed a quick fix for this problem tonight, and made the following modifications:
I edited part of the notify_menu function:
$items['user/%user/notify'] = array('title' => 'Notification settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('notify_user_settings_form', 1),
'access callback' => 'notify_user_access',
'access arguments' => array('access notify', 1),
'type' => MENU_LOCAL_TASK
);
I added a notify_user_access function:
function notify_user_access($string, $account = NULL, $reset = FALSE){
return $account && $account->uid &&
(
// Always let users view their own profile.
($GLOBALS['user']->uid == $account->uid) ||
// Administrators can view all accounts.
user_access('administer notify')
);
}
and I modified the notify_user_settings_form function:
uid != $arg->uid && !user_access('administer notify')) {drupal_access_denied();
return;
These ideas were gleaned from:
http://drupal.org/node/109157
http://api.drupal.org/api/function/user_access
http://api.drupal.org/api/function/hook_menu/6
A modified "notify.module" file with these changes is attached. This file also contains modifications that fix the count of comments in email notifications (was printing "!count" instead of the value).
#3
jhawson,
Could you roll a patch please?
Thanks.
#4
OK, the patch is attached. I modified the code slightly from last night's post, in an attempt to respect the intention of the "access notify" permission (my interpretation of its purpose, at least). I'm assuming that if authenticated users have this permission, then they should be able to view their own notification settings.
I omitted the changes related to "!count" appearing in email messages; those are probably the subject of another issue.
Jeff
#5
Thank you for the patch, this was an issue for me too.
#6
Thank you for the patch. It solved my issues as well. Take it easy!
#7
Patch reviewed, polished, & committed. Thanks.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.