Computer Specs:
Windows XP SP2
PHP 5,2.8
MySQL 5.1.30
Drupal 6.9
I installed the Workflow 6.x-1.1 module, and I set up an action to change the author of the post on each workflow transition. When the transition occurs, the author is not changed. When researching this issue, I discovered that the problem is not specific to the workflow module.
For example, assigning a "change the author of a post action" to "Trigger: After saving a new post " also does not work. Neither does "Trigger: After saving a new comment".
So far the only trigger I have gotten to work is: "Trigger: When either saving a new post or updating an existing post".
In the database tables, the action and trigger_assignments both have correct row entries, so the issue must be in the controlling code after the trigger occurs.
Doing a text search of the Drupal project, I found a reference in trigger.admin.inc for the trigger_assign_form_submit function that is the only reference to 'presave' (the key of the trigger that is working) that might be causing the problem.
The code is:
if (isset($actions[$aid]['behavior']) && in_array('changes_node_property', $actions[$aid]['behavior']) && ($form_values['operation'] != 'presave')) {
// Delete previous node_save_action if it exists, and re-add a new one at a higher weight.
$save_post_action_assigned = db_result(db_query("SELECT aid FROM {trigger_assignments} WHERE hook = '%s' AND op = '%s' AND aid = 'node_save_action'",
This may not be what is causing the issue, but it is the only place I have found that seems to be unique to the 'presave' key.
In step-by-step form to way to reproduce the issue is:
1. Create a new "Change the author of a post..." action with the author as a user other than the logged in user
2. Assign that action to a trigger; "Content: After saving a new post" was what I used
3. Create a new post and save it.
4. Note that the first line of the node still says you are the author; ex:Tue, 01/27/2009 - 18:24 — admin
Comments
Comment #1
mkiestmcfarland CreditAttribution: mkiestmcfarland commentedUpdate:
I have established that issue occurs sometime after the action generates the log entry to the watchdog table.
That tables says the author has been changed, but the node table remains unchanged.
Comment #2
Andreas Wolf CreditAttribution: Andreas Wolf commentedI have the same issue. Author is not changed.
Edit:
I deleted most of my text, since it was not related like I thought first.
Post is now in #403034: node_assign_owner_action() logs an object type instead of the type name.
Sorry about that.
Comment #3
Martin.Schwenke CreditAttribution: Martin.Schwenke commentedI'm seeing this too, also with workflow. However, as the above comment suggests, this might not be specific to workflow.
I create a node using:
drupal_execute('mynodetype_node_form', $form_state, (object)$node);
from custom code at a URL that I fetch with wget. The node is created and shows up as authored by "Anonymous" and is in my initial workflow state.
Then a subsequent workflow transition is supposed to change the author... but it doesn't. :-(
This happens even if the user initiating the workflow transition is the main admin user, so I don't think it is a permissions issue...
Comment #4
Martin.Schwenke CreditAttribution: Martin.Schwenke commentedWhen creating a node the transition from (creation) to my "Draft" state was attempting to set the author but was also (intentionally) setting the node to "unpublished". I just removed the "unpublished" trigger, created a node and suddenly my draft forms have their author set properly!
So, I wonder if there's some weird interaction between the unpublished state and setting the author?
Are other people who are seeing this bug also setting nodes to unpublished at some stage?
Comment #5
futrick CreditAttribution: futrick commentedI've found a solution.
(...at least one that's working for our site)
Apparently the order that you assign the triggers to the Workflow states matters.
Here are the 3 configurations I tested when moving an article from the state "Review" to the state "Approved".
Config 1: (in order of assigment)
Publish Post
Save Post
Change Author
Result: Published post but did not change author
Config 2:
Change Author
Result: Did nothing
Config 3: (in order of assigment)
Change Author
Publish Post
Save Post
Result: Changed author and Published Post
Current Setup - Drupal Core 6.14, Workflow Module 6.x.11
Comment #6
Martin.Schwenke CreditAttribution: Martin.Schwenke commentedThat's consistent with the order that I see working. Perhaps when I messed with the publish/unpublish stuff I also changed the order? Not sure...
Comment #7
Martin.Schwenke CreditAttribution: Martin.Schwenke commentedConfirming that it seems to be the order that matters.
I needed to change who certain nodes get owned by after a state change. I added a new action for the new author, unassigned the action for the old author on the Triggers page and then assigned the new action. The new action was listed last and didn't take effect. I've now moved it to the top in the hope of fixing the problem.
Perhaps "Save post" also needs to be associated with "Change author..." so that if a "Change author..." is added last then the save will happen afterwards?