If after creating a node, I populate the scheuler table with data using a PHP script, is there a function that I need to run to ensure that Drupal will look at the new data in the scheduler table again?
Thank you. Great module!
Mitch
If after creating a node, I populate the scheuler table with data using a PHP script, is there a function that I need to run to ensure that Drupal will look at the new data in the scheduler table again?
Thank you. Great module!
Mitch
Comments
Comment #1
freeman-1 commentedYou could examine the scheduler_nodeapi function to see what other actions normally get called. Notably, one of the actions, using the node edit form, is 'submit', which will reset (=0) the status field (that is unpublish) of the node.
My preference is to populate the candidate node object with the (un)publish times and timezone, then use node_submit() followed by node_save(). This is neater than making additional direct sql calls to scheduler's table and the node table.
If you were running loops to amend existing scheduler times, using node_load wouldn't get the scheduler info fields to the object. That's why I proposed adding the node 'load' action to the nodeapi hook.
Comment #2
mwander commentedfreeman,
Thank you for the info. I've been working on this for a bit too long today - and am still stuck.
Is there any chance that you could please provide sample code that would, "populate the candidate node object with the (un)publish times and timezone, then use node_submit() followed by node_save()."
I've tried to do this a few different ways and cannot figure out how to reference the node object for attributes related to the Scheduler module.
Much appreciated.
Mitch
Comment #3
freeman-1 commentedHi Mitch,
here goes:
Hope this helps. I don't use $node->unpublish_on in this case.
Comment #4
mwander commentedfreeman,
Works like a charm!
I've combined what you wrote with the script at http://drupal.org/node/67887 that I've modified for my purposes. All is well.
I was not sure how to populate the $node object and now I understand more about how it works - thanks to you.
One note for anyone who is trying this, remember that if you are populating the $node object using this code, the format is yyyy-mm-dd hh:mm:ss - whereas if you were populating the db directly, this parameter is stored as a timestamp.
Thank you, again!
Mitch
Comment #5
AjK commentedComment #6
(not verified) commented