Drupal URL Redirect after Node Creation

Services Flowchar full

Drupal URL Redirect after Node Creation

Over the past few weeks I’ve had a couple of clients who were using webform for registrations, and while it can work on a small scale, for their needs it just wasn’t right. The problem is that having used webform, their accustom to 3 things: an easy thank you message or page redirect to a thank you page, a generated email informing the site administrator about the submission and finally an easy to export option for the data from webforms. In order to deliver a proper solution I had to find a way to keep the same functionality while moving their forms into actual user generated nodes. The first part was easy, create a new content type and call it Registrations and then add the needed CCK fields. With that information I could then create a table view with all the data, save it as an exportable feed view using the views bonus pack and now they have an easy to export version of the data. Second, we need to redirect the registrants to some sort of thank you page; initially I thought using triggers and actions would be the way to go and with a little setup it they were being redirected to the proper URL. The problem with that solution is that the URL redirect was occurring before the actual Drupal hooks could fire; as a result, none of the needed CCK field data was being saved. Since the auto generated email was using the same system, the email would fire but again no saved data. I did some more research and came across a blog post from 2007 and how Workflow-ng could solve that problem; the problem is that Workflow-ng is only for Drupal 5. However, don’t worry as this module has been changed to Rules for Drupal 6, and using Woflgang’s instructions for Workflow-ng the same results can be achieved. Simply create a new triggered rule, mine was fired on created new sticky content as none of our current content types need that functionality, and then have it do an action of either redirecting or sending an email. You can create one rule to fire several actions at the same time, so I added on that same rule with the Drupal URL redirect. The great part about this method is all of this occurs after all the Drupal hooks have fired so you don’t lose any of your data.

Related Posts

Don't sync Drupal files to local environments. Redirect them Instead.

Mark Carver
Read more

Drupal node publishing options

Tom McCracken
Read more

How to Add Drag and Drop Blocks to any Node on your Drupal Website

Randall Knutson
Read more

Getting Started with Content Creation

Tabatha Patterson
Read more

Redirect all requests to a canonical domain

Dustin Currie
Read more

Learning Through Drupal Case Studies

Sean Keeley
Read more