for some reason this module doesnt work together with node go to module. http://drupal.org/project/nodegoto
what i was trying to do was change the owner of a node to the content of a userreference field right after creation (for revision). this gives the user an access denied message after submitting (because it is unpublished). to avoid this i used the node go to module to redirect to a "thank you" page.
But: when i activated it, the node owner change action and the unpublish action were not performed any more. it pretends to do it in the node form, but in the background it really doesnt (no log entry).
maybe the node go to module changes to the new node before the actions got their data from the content fields.
ok.. maybe this is really a report for the node-go-to maintainer.
thanks.. btw this is a great and very flexible module!

CommentFileSizeAuthor
#2 nodegoto_form_alter.patch2.78 KBCloudCuckoo

Comments

mfredrickson’s picture

Project: Field Actions » Node Go To
Category: feature » bug
Priority: Normal » Critical

You are correct. This is a bug in nodegoto.

The problem is the heavy use of drupal_goto(). This function sends a redirect header back to the user's browser and stops drupal's execution. Thus, the workflow stuff never runs.

What you're seeing:

- Fill out form
- Submit
- Hook nodeapi is invoked
- nodegoto_nodeapi is called
- calls drupal_goto('target page')
- user goes to target page
- oops - workflow + actions never gets to run!

Nodegoto could be reimplemented to use a #submit handler on any node form. This means that nodegoto registers a function to be called whenever a node form is submitted (during creation, editing, and deletion). In that function, you just return a string of where you suggest the user go after the form is completely submitted.

This chain of events would look like
- form is built
- nodegoto_form_alter adds a #submit handler to the form
- Edit
- Submit
- nodegoto's #submit function is called
- nodegoto's #submit function suggests the user go to 'target page'
- nodeapi is invoked
- workflow + actions runs
- Drupal sends user to suggested page.

IMNHO, this would be the correct way to implement nodegoto.

Good luck!

-Mark

CloudCuckoo’s picture

Status: Active » Needs review
StatusFileSize
new2.78 KB

Patch attached implements suggestion in #1 to use hook_form_alter rather than hook_nodeapi. I haven't tested it with the field actions, workflow modules etc just that nodegoto still works. I'm unsure about how I've dealt with the $camefrom for new nodes - there's probably some cool and far more sensible way to go, but hey I'm a noob and at least this is a start.

introfini’s picture

Assigned: Unassigned » introfini
Status: Needs review » Fixed

Patch added.

Thanks Cloudy, great patch!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.