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

Rob T - January 16, 2009 - 19:44

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

jhawson - February 2, 2009 - 02:19

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).

AttachmentSize
notify.module.zip 6.45 KB

#3

matt2000 - February 3, 2009 - 01:27
Assigned to:Anonymous» matt2000
Status:active» postponed (maintainer needs more info)

jhawson,

Could you roll a patch please?

Thanks.

#4

jhawson - February 3, 2009 - 05:10
Status:postponed (maintainer needs more info)» needs review

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

AttachmentSize
notify-352932-4.patch 1.54 KB

#5

stoptime - February 13, 2009 - 22:25

Thank you for the patch, this was an issue for me too.

#6

bitsize - March 13, 2009 - 01:10

Thank you for the patch. It solved my issues as well. Take it easy!

#7

matt2000 - March 13, 2009 - 02:33
Status:needs review» fixed

Patch reviewed, polished, & committed. Thanks.

#8

System Message - March 27, 2009 - 02:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.