Published in Drupal By hiren
Redirect to success page after saving new node
Many times you need to redirect to sucess page after saving new node. Some are using the nodeapi hook under ‘insert’ operaton like
function custom_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
...
if ($op = 'insert') {
drupal_goto('success_page');
}
..
}
In such case modules having nodeapi hook, which has higher priority then custom module are not called. So, node having access level permission might not set properly. You might need to rebuild the permissions. You can also call node_access_acquire_grants($node) alternatively.
The better solutions in such scenario is to use the #redirect property of the form api via form_alter
$form['#redirect'] = 'success_page';