Community

Redirect after node add/update including nid

Hi,

I have a situation where I need to redirect the user to a specific URL after a node is added or updated.

I have found several posts which show the hook_form_alter examples, but I cannot see how I can access the relevant node data to structure my URL for the redirect.

My redirect url uses node->nid and a custom field node->field_relatedproject in order to redirect to the URL that I need.

Is there a way to access the content of these fields in the hook_form_alter or hook_form_submit process?

thanks

Comments

Have you tried using the

Have you tried using the rules module?

You know, I sometimes

You know, I sometimes surprise myself by trying to make things more complicated than they need to be.

Rules is perfect for this! Having used Rules for a number of other things, I really don't see why I missed it for this.

I think this is one of those times when you "can't see the forest for the trees."

Thanks for pointing me in the right direction.

Hi-

I'm in the same boat - well sort of.

I want to allow a user to update a node of type blah, and then be redirected back to a summary view of those nodes.
I'm trying with rules, but I get the error "The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved."

Makes me think Im stuck in a loop somewhere. So I've even tried to force rules to save the node(entity) then redirect, but still no luck.

Any thoughts?
TIA for any insight

Here's my rules stuff:

After updating existing content
Content is of type
Parameter: Content: [node], Content types: blah
Save entity
Parameter: Entity: [node], Force saving immediately: true

Page redirect
Parameter: URL: http://drupal.org

You probably don't want the

You probably don't want the 'save entity' part.

nobody click here