Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm looking for a hook to use after a node of a specific content type is created or saved, to perform a redirection to a specific page.

share|improve this question

4 Answers 4

up vote 4 down vote accepted

In case of Drupal 6 hook_nodeapi() will help to perform on various actions, basing on the value of the first argument passed to the hook ($op).

  • alter
  • delete
  • load
  • update

In Drupal 7 there is a number of hooks for this.

share|improve this answer

Form redirect after node save. This blog discusses the usually way of redirecting a form, the problem with node forms, and how to solve them for Drupal 6. I believe it should also work for Drupal 7

share|improve this answer

For the completeness of this thread, here is a link to a more detailed answer.
Either code it or add a rule using the rules module.

share|improve this answer

If "created" and "saved" mean node has been on database, here some option.

/**
 * Implements hook_form_NODE_TYPE_node_form_alter()
 * Add some action to submit button
 */
function CUSTOM_MODULE_form_NODE_TYPE_node_form_alter(&$form, &$form_state){
    $form['actions']['submit']['#submit'][] = 'CUSTOM_MODULE_form_NODE_TYPE_node_form_submit';
}
function CUSTOM_MODULE_form_NODE_TYPE_node_form_submit(&$form, &$form_state){
    $node = $form_state['node'];
    // CHECK NODE TYPE AND REDIRECT
}

Here similar case which can be done by this option.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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