I have subscriptions 6.x-1.0-beta2 working great on my site. The only exception is that for new posts that are submitted via Mailhandler, subscriptions do not send out notifications of these as new posts. Suggestions?
Thanks for this module!
I have subscriptions 6.x-1.0-beta2 working great on my site. The only exception is that for new posts that are submitted via Mailhandler, subscriptions do not send out notifications of these as new posts. Suggestions?
Thanks for this module!
Comments
Comment #1
salvisThis means that Mailhandler does not call all the hooks in the proper order as core does when a user creates posts manually.
Specifically, Subscriptions expects hook_nodeapi() to be called with 'prepare' and then 'insert', or hook_comment() with 'insert'.
Comment #2
michellezeedru commentedI'm not a developer, so don't know what's involved in making this work. Is this something that should/can be fixed? If so, is there any chance this can be fixed anytime soon?
Comment #3
z.stolar commented@salvis: I don't think you're right, since mailhandler uses node_save(), which invokes hook_nodeapi, with $op = 'insert'.
@mziegmann: What are your default commands for mailhandler? Besides the subscriptions, which do not work - does everything else run as expected?
Comment #4
michellezeedru commentedThe default commands I have set up in Mailhandler are:
type: forum
tid: 18
status: 1
Everything else works as expected.
Comment #5
salvis@z.stolar: $op = 'prepare' ?
Comment #6
z.stolar commented@salvis: as far as I understand the subscriptions_content.module code, there's something that doesn't make sense there, and I think it's really a subscriptions bug (using 6.x-1.0-beta2):
in hook_nodeapi, $op=insert is invoked when running node_save, like mailhandler does. $op=prepare doesn't seem to have any influence on $op=insert, so the node should be added to the subscriptions queue (I admit I didn't really dive into the code, so I might be missing something).
I didn't see many modules that actively use $op=prepare. It's good to have that op of course, but one cannot expect other modules to invoke it.
Comment #7
salvis@z.stolar: Thank you for looking into this!
Drupal pre-populates new nodes with a number of elements before calling hook_nodeapi('prepare'), including the status, promote, sticky, and revision flags. Subscriptions takes this opportunity to add the subscriptions_notify flag, which also goes into the Publishing options fieldset. I believe these flags should be there, at that point, so that other modules get a chance to manipulate them if they want.
By not calling hook_nodeapi('prepare') in the way that core does, you are starting a ripple effect: you need to request that Subscriptions doesn't use the hook, and whichever module might come later in the food chain will then not get its input either, etc., etc. Following that road would lead to a degeneration which might eventually let you say , but this is not how it's supposed to work.
If Mailhandler wants to mimick core node addition, then it has to do it exactly the way that core does, and not try to cut corners and weaken the process. It's not up to the contribs to decide which core hooks are worthy to be respected and which aren't.
Comment #8
z.stolar commentedMailhandler doesn't cut corners. The api documentation for hook_nodeapi states that
.
Nodes can be saved programmaticly, using only node_save(), without invoking hook_nodeapi with $op='prepare'.
For comparison, look at core's blog api node creation function.
Comment #9
salvisI'm not sure whether blogapi_blogger_new_post() is correct in not calling node_object_prepare(), but I've found a way for Subscriptions to get by without getting a hook_nodeapi('prepare') call, for insertions. Committed to the -dev versions.
Thanks for the discussion; see #196273: Eliminate call to node_object_prepare(&$node) function for some more...
Comment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.