Closed (duplicate)
Project:
Notifications
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2009 at 01:10 UTC
Updated:
8 Jun 2009 at 14:48 UTC
notifications_get_link() in notifications.module has this test:
if (!empty($params['sid'])) {
$elements = array('unsubscribe', 'sid', $params['sid']);
}
elseif (!empty($params['uid'])) {
$elements = array('unsubscribe', 'uid', $params['uid']);
}
break;
but this fails when uid = 0, causing $elements to be undefined for anonymous users, as empty() returns true for the value 0 (anonymous). This patch solves this with using isset() instead:
if (!empty($params['sid'])) {
$elements = array('unsubscribe', 'sid', $params['sid']);
}
elseif (isset($params['uid'])) {
$elements = array('unsubscribe', 'uid', $params['uid']);
}
break;
I guess this function is called with either 'sid' or 'uid' as a parameter, so no default else-clause should be necessary.
I have in addition tested for non-anonymous users in notifications_token_values() on the 'user' token type. This is the function causing things to fail for anonymous users. I guess there is no reason to provide links for anonymous users.
| Comment | File | Size | Author |
|---|---|---|---|
| notifications-anon-unsubscribe-links.patch | 1.29 KB | kaare |
Comments
Comment #1
kaareUps.. I haven't search the issue queue well enough. This is apparently a duplicate to #453498.