"Publish unless Scheduled" and "Unpublish unless Scheduled" Actions

usonian - March 20, 2008 - 20:55
Project:Scheduler
Version:5.x-1.12
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active (needs more info)
Description

I know this may be a fringe use case, but I'm working on a site using both Workflow/Actions AND Scheduler. In a nutshell, here's our use case:

* Submitter adds a new node, and has the option of using the Scheduler "publish on" field to indicate that they want it to go live at a later date
* Node remains unpublished and goes into a "Needs review" workflow state
* Reviewer looks at the node and may choose a "Approved" workflow state, which normally triggers the stock 'Publish node' action

The problem is that this will always immediately publish the node, even if the submitter has specified a later date and time per the Scheduler module.

We are not using the "Schedule for state change" section of the workflow form because:

1) The submitter doesn't get to see it
2) The reviewer shouldn't have to manually copy a date from somewhere else

This patch provides two new actions:

* "Publish unless Scheduled": when triggered, checks whether $node->scheduler['publish_on'] is empty; if yes, the node is published immediately. If no, it is left alone.
* "Unpublish unless Scheduled": when triggered, checks whether $node->scheduler['unpublish_on'] is empty; if yes, the node is unpublished immediately. If no, it is left alone.

The patch also provides installer update/uninstall functions to add/remove the new actions to the actions_registry table.

AttachmentSize
scheduler_actions_publish.patch3.74 KB

#1

skiminki - April 24, 2008 - 12:57

Hmmh... I tried this patch but the actions didn't get visible in actions menus. What version of actions-module is this patch for? I'm willing to include this in a future release, if I can see it working.

#2

skiminki - April 24, 2008 - 12:58
Status:patch (code needs review)» active (needs more info)

#3

usonian - April 24, 2008 - 19:05

Hmm, did you run /update.php as user 1 after applying the patch?

#4

skiminki - April 24, 2008 - 20:20

That was the first thing I did after applying ;) Then I installed workflow-module and saw that its actions went to the list as they should.

I'm not too familiar with actions module, but I noticed that workflow-module has function workflow_action_info(), which seems to declare the actions. This patch doesn't have that but instead functions prefixed with action_scheduler_ . That's why I suspect different major version. I tried 5.x-2.3.

(Just to remind me later: there's a typo in function name schedules_uninstall.)

 
 

Drupal is a registered trademark of Dries Buytaert.