[drupal-devel] Users self-publishing their content

John VanDyk jvandyk at iastate.edu
Wed Aug 17 22:49:19 UTC 2005


>PS: my understanding is workflow.module is in flux right now, with
>issues with revisions. So I'd guess it won't be ready until post-4.7,
>but of course I need this sooner - like a week or two.

Workflow should do you what you want with the following patch to 
preserve revisions

http://drupal.org/node/27007

provided you understand the issues. The nodeapi calls for nodes go like this:

1. nodeapi validate hook
2. (node is saved)
3. nodeapi insert/update hook
    a... modules respond
    b... modules respond
    c... modules respond
    ...
    workflow modules responds, fires actions, the last of which saves 
the node (go to 2)
    x... modules respond
    y... modules respond
    z... modules respond

As you can see, we have some problems. Because module_invoke() works 
alphabetically, any modules with names alphabetically after 
"workflow" have not yet responded when the workflow hook is invoked. 
Remember, the workflow hook activity looks like this:

1. nodeapi insert/update is caught by workflow module
2. workflow module fires the 'transition pre' workflow hook to let 
modules know a transition is about to occur
3. modules have a chance to veto the workflow transition
4. if no module vetoes the transition, the 'transition post' workflow 
hook is fired so modules can respond to the workflow state change.

So to move ahead, we need a 1a nodeapi hook that says, "validation 
passed and this node will now be saved" so workflow changes can 
happen there, and/or a 4 nodeapi hook that says, "the node has been 
saved, all modules have done their thing, it's safe to do a node_load 
and get a node that is in a consistent state".

I'd like to see both because it gives maximum flexibility for 
workflow. For example, it's much more efficient to change the status 
of the node to published after validation but before saving than it 
is to use the current method of saving the node again.



More information about the drupal-devel mailing list