jodm
jodm

Reputation: 2617

Drupal 6 - Redirect after add taxonomy term

When adding a taxonomy term in Drupal, it redirects back to itself to add another term. Is there a way of overriding this?

I have so far tried:

• Adding ?destination=_ to the page that links to the /add/term/ page
• Tried hook_taxonomy:

function modulename_taxonomy($op, $type, $array = NULL) {
  if ($type == 'term' && ($op == 'insert' || $op == 'update') && $array['parent'][39] == 39) {
    drupal_goto('page.html');
  }
}

If instead of drupal_goto() I put die('Here'); it outputs, but the drupal_goto() does not work?

Upvotes: 2

Views: 545

Answers (2)

Oswald
Oswald

Reputation: 31675

Implement hook_form_FORM_ID_alter one of the following ways.

  • If you know in advance where you would like to be redirected, change the $form['#redirect'] entry.
  • If you only know after submission where would like to be redirected, add an additional callback to $form['#submit']. That callback receives the $form array and the &$form_state array reference. Set the $form_state['redirect'] entry to he path that you want to redirect to.

Upvotes: 5

Brice Favre
Brice Favre

Reputation: 1527

You can use rules module, and i'm sure you can create an action to redirect to an URL.

Upvotes: 0

Related Questions