1

In several places on my site I use an "add node" link that lets users add a node (I'm using organic groups). After saving the node, I'd like to redirect users back to the page on which they clicked the "add node" link.

I know how to redirect users to a specific page after saving a node, but that doesn't work in this case, as the add link shows up on several pages.

I've tried setting $form_state['redirect'] = false, but that also doesn't help as it puts users back in the node edit page.

Would be wonderful if anyone could point me in the right direction. Thanks!

EDIT: 2 minutes after I posted this I came up with the following: <a href="node/add/contact?destination=node/52">Add Contact</a>

This redirects the user to node 52, which happens to be the group page on which this add link lives. This is a step in the right direction. Would be even better if I could use a token in the link.

0

You can use Token Filter module and the following code should work:

<a href="node/add/contact?destination=[site:current-page:path]">Add Contact</a>

Make sure that the token filter is available in the text format you are using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.