I've been floundering through the documentation and examples, and have tried searches on various relevant terms, but I haven't found anything that seems to equate to what I need to do, which is:
A - Create a scheduleable rule to publish a specific revision of a node. This can be done using "execute custom php code", but it needs to know the revision to publish.
B - Create triggered rules for new and updated content that schedule the publish-revision rule. When these rules are triggered, I need to pass the current revision id for the node through to the scheduled rule.
Note that between create/update time and scheduled publish time, other revisions of the node may be created, so simply publishing the latest (or current) revision at scheduled time is not sufficient. I have to know what the revision id was at save/update time.
A couple of possibilities come to mind:
1 - At first I thought creating a new number variable at trigger time might be the way to go, but it seems that variables created then are not available to the scheduled rule, right?
2 - Can I get the "user-supplied" task identifier from within php code in the scheduled rule? If so, I can store the revision ID there and parse it out at scheduled time.
3 - Or? Is there something I'm missing?
Any advice or pointers to documentation/examples appreciated, thanks.
Comments
Comment #1
johnpitcairn commentedWell, I got something working.
I had to create a small module to provide a new Rules event "a new moderated revision was created", and new action "published specified revision".
These supply and require (respectively) an additional "number" argument, the node revision id at the time the revision is created. This can then be passed through the Rules UI as an argument, and stored by the Rules Scheduler.
This avoids the problem of getting node->vid from the "content" variable, which appears to be obtained from node_load(), and therefore returns the "current" (published) revision id, not the specified (unpublished, moderated) revision id.
I'll post sample code on request - I'm using the Revisioning module (D6).
Comment #2
lrichards commentedHi John,
I'm running into a similar problem with Revision Moderation and Scheduler that I think could be solved with something like your custom module with similar Rules/Actions. Would you mind posting your sample code?
Thanks!
Comment #3
johnpitcairn commentedThis code uses the Revisioning module for the function _revisioning_publish_revision().
It adds a Rules event/action combo with an extra available argument - the new revision vid - and fires the event trigger from the hook_nodeapi() insert and update operations. The argument must be specified in your Rule Set and your Triggered Rule, so it will be stored for later use by the Scheduler.
Comment #4
lrichards commentedThanks John, should be a great start for us!
Comment #5
itangalo commented