How to redirect after save update and delete
This is how you redirect after Save, Update and Delete by changing the action. Do not use #redirect in form because it wont work with Delete operation.
<?php
function mymodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == "opportunity_node_form" OR $form_id == "link_node_form") {
$spaces = spaces_get_space();
if ($form_id == "opportunity_node_form") {
$redirect_path = $spaces->group->purl . "/seo/offpage";
}elseif($form_id == "link_node_form") {
$redirect_path = $spaces->group->purl . "/seo/offpage/links";
}
if (strpos($form['#action'], 'destination') === FALSE) {
$form['#action'] .= '?destination=' . urlencode($redirect_path);
}
}
}
?>
Knowledge keywords: