If you have enabled subscriptions to use cron and you have a cron job configured, the subscription emails don't get sent. If you manually trigger the cron job through this page http://www.example.com/admin/logs/status it works fine.

I believe this behavior is because the node_access function in Drupal 5 does not take in $uid as a parameter and instead it uses the Global $user. See http://drupal.org/node/72487 for a discussion that lead to this change.

This means that when you manually trigger cron it looks at your permissions, not that of the recipient ($subuid) and if you have the right permissions, node_access returns true and the messages get sent. When cron is run through a cron job, there is no global user, so node_access fails and your messages don't get sent. There are other issues identified in the above issue. If your subscriptions are set to send immediately, then it would use the permissions of the user who just created the node, not the recipient.

As far as I can see there are two options. Load $subuid, run node_access and then load the original user. Or rewrite node_access to use the $uid, not Global $user. It's probably better to switch users.

Comments

arthurf’s picture

Ok, interesting points. I will look at this and work on incorporating this over the next bit of time.

neubreed’s picture

I found an error in the logs possibly related to this:

Invalid argument supplied for foreach() in /subscriptions/subscriptions.module on line 615.

mindless’s picture

Assigned: Unassigned » mindless
Status: Active » Fixed

should be fixed in DRUPAL-5 branch, please try it out.

the foreach error in comment #2 is not related, but i'll fix that too.

Anonymous’s picture

Status: Fixed » Closed (fixed)