I'm using Taxonomy subscriptions. I've got two users on my website right now: the admin and a test user (authenticated user), which are both subscribed to every taxonomy term that's available. When I'm creating new content and add a taxonomy reference to it, the subscriptions_queue table gets filled with two rows: one for the admin and one for the test user.
But during the next cron job, only the mail to the admin gets sent, allthough both rows in the subscriptions_queue table get deleted.
I got no error messages in watchdog, only two notifications:
- Notification sent to...
- Subscriptions sent 1 single and 0 digest notifications…
I'm using the smtp module, but that shouldn't be a problem, or should it?
Any help is appreciated, if you need more informations, please ask! Thank you.
Comments
Comment #1
karingI was able to reproduce this (editing content) - let me dig in see if I can figure out what may be happening.
Comment #2
salvisAre you sure that the two records are for the two users, and not for the same user (caused by two different subscriptions for the admin that got both triggered)?
Comment #3
karingActually everything is working well.
After clearing out all subscriptions in the My account -> Subscriptions tab for both admin and test user [only one left is 1 Category subscription -> to the same Taxonomy Term] - all is working well. If I add another bit of Content -> and select the specific Term Reference that both users are subscribed to -> run cron -> both users get the notification.
What does your table look like? Should be similar to:
Comment #4
aTrotter commentedMy table almost exactly looks like yours, with one little difference: There's a language set for the admin user, but not for the test user. I'll look into that, if this has anything to do with my problem.
EDIT: So wheter I add 'de' to the language field of the test user row, or i remove 'de' from the admin user row, doesn't change the behaviour at all: admin mail gets send, test users's mail doesn't.
Comment #5
karingSalvis just informed me he committed a new option: "Display watchdog debug entries for all mailings" to the Subscriptions -dev versions. Can you update to -dev and enable that? And then we'll puzzle on.
Comment #6
aTrotter commentedOK, i just updated to the dev-version and checked the watchdog option.
After executing cron there's one new wathdog message:
Notification for admin (trotter@mysite.com) passed on to drupal_mail(), result=[1].
There's no entry for the test user and still the mail doesn't get send.
Comment #7
karingOk, re-update again (latest dev includes more debug info) and tell us what you get.
Comment #8
aTrotter commentedI get the same message as in #6 plus one new:
User admin was unable or not allowed to subscriptions_content_load_node(s:2:"53";).
Comment #9
salvisOops, the user name is the wrong one (this will be fixed in the next package in 4h), but the rest should be correct.
Please check whether your 'test' user is able to view node/53.
Comment #10
aTrotter commentedYes, the test user can view node/53
Comment #11
salvisThis is not the result that I expected. I've pushed yet another update that will give us just a little more information...
Comment #12
aTrotter commentedNow i've got:
User test was denied access to subscriptions_content_load_node(s:2:"54";).
But i can access node/54 with the test user.
Comment #13
karingWhat are you using for node access control? Have you tried rebuilding permissions?
Comment #14
aTrotter commentedI'm not using any special module for node access control. Just Drupal standard. I've just rebuilt the permissions and run cron, but there's still the same error in watchdog as before.
Comment #15
karingWhich user is creating the new content?
Comment #16
aTrotter commentedThe admin user (uid 1) is creating the content.
Comment #17
karingRight - user ID = 2 has no permission to create / just to view?
Comment #18
aTrotter commentedThe test user has uid 52, but yes, he can only view not create content.
Comment #19
salvisI'm losing hope that we can diagnose this remotely. You need a PHP developer with access to your site who can debug this locally.
Comment #20
aTrotter commentedWell, I'm a PHP developer myself (more or less):
In the subscriptions_mail.cron.inc the call to module_invoke_all('subscriptions', 'access', $load_function, $load_args, $object);
returns Array ( [0] => 1 ) for the admin user (uid 1), but Array ( [0] => ) for the test user (uid 52).
I guess that's the problem. I'm not sure though how to check which modules are invoked by this call. Is there a way to get this information?
Comment #21
salvisOh, good. Look for
function module_invoke_all— there core enumerates the modules that define hook_subscriptions(). Find out which one returns the non-NULL value. Then look there...Comment #22
aTrotter commentedSo, the only access funtion that gets called multiple times during cron is node_node_access.
The Problem is, that "view" gets submitted as the $op param, and so NODE_ACCESS_IGNORE (which equals NULL) gets returned every time. So I GUESS that's the problem, But at this point i'm not sure how to proceed. Any ideas?
EDIT: I'm also not sure which modules get invoked by this call:
drupal_alter('subscriptions_access', $access);How can i check this?
Comment #23
salvisWhere is node_node_access() called from?
Comment #24
aTrotter commentedI guess from
$access = module_invoke_all('subscriptions', 'access', $load_function, $load_args, $object);I'm not sure, though.
Comment #25
salvisNormally, node access is evaluated in the
$load_function($queue_item)call. If that returns TRUE, then your user has access.drupal_alter('subscriptions_access', $access);doesn't work at all, unfortunately. I doubt that it has any effect, but...
Install the Devel module and add a
dpm($access, $user->name);call before and after that call, and let us know what you find.Comment #26
aTrotter commentedWell, for the admin user $access is a array with one element with the value 1
after the call to module_invoke_all and after the call to drupal_alter
For the normal user, after both function calls $access is an array, also with one element, but the value is empty (or NULL).
Comment #27
salvisYes, and we have to find out where the NULL comes from. It's not node access but a module that implements hook_subscriptions().
You have to temporarily add debug/trace code to module_invoke_all() to find out...
Comment #28
aTrotter commentedAh, ok.
i've added
if($hook == 'subscriptions') { print $function;print '<hr />'; }to the module_invoke_all function and what I got was subscriptions_taxonomy_subscriptions and subscriptions_content_subscriptions.
Comment #29
salvisAnd which one returns the empty value?
Comment #30
aTrotter commentedFor the admin user subscriptions_taxonomy_subscriptions returns an empty value. subscriptions_content_subscriptions returns 1.
For the test user both functions return an empty value.
Comment #31
salvisCould it be that your node is not published?
subscriptions_content_subscriptions() (or actually _subscriptions_content_access()) should return TRUE. If it doesn't, then you have to take it apart and find out why it doesn't.
#26:
This is not possible. module_invoke_all() will not create an array element with a $result of NULL.
Comment #32
aTrotter commentedOK, so the test user now also gets subscription e-mails.
I had to set the permission for the authenticated user to:
Is this right? I only want to grant the user subscriptions to taxonomy terms and i have to grant him subscription to all content types for that?
Comment #33
salvisIf it takes Subscribe to all content types then you've added the content type in question to the Blocked Content Types on admin/config/system/subscriptions.
Comment #34
aTrotter commentedOK, you're right. I'm sorry for causing you all this trouble.
Comment #35
salvisWhat can we learn from this?
First disable and uninstall Subscriptions (and possibly Mail Editor) to get rid of any messed-up customizations, then start from scratch.
Comment #37
mooru commentedi ran into this same problem. On my MAMP local dev, all users get notification mail but when i move to the production server only admin gets the mail. I have uninstalled and reinstalled but nothing. What more can i do. I really need this to work