7

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.

4

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.

5

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

0

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.

0

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.

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.