function domain_node_save_redirect in Domain Access 7.3
Same name and namespace in other branches
- 6.2 domain.module \domain_node_save_redirect()
- 7.2 domain.module \domain_node_save_redirect()
On a node save, make sure the editor is returned to a domain that can view the node.
The node id is saved in the $_SESSION during hook_nodeapi(). We must do this because node_form_submit() overrides the form's redirect values.
For extra checking, we also store the source domain_id and try to redirect to that domain if we accidentally moved. However, the node must be visible on that domain.
Return value
No return value. Issue a drupal_goto() if needed.
1 call to domain_node_save_redirect()
- domain_init in ./
domain.module - Implements hook_init().
File
- ./
domain.module, line 3088 - Core module functions for the Domain Access suite.
Code
function domain_node_save_redirect() {
global $_domain;
// If no session token, nothing to do.
if (!isset($_SESSION['domain_save_id'])) {
return;
}
$domain_id = $_SESSION['domain_save_id'];
// Unset the token now so as not to repeat this step.
unset($_SESSION['domain_save_id']);
$source = domain_lookup($domain_id);
if ($source['domain_id'] != -1 && $source['domain_id'] != $_domain['domain_id'] && ($source['valid'] || user_access('access inactive domains'))) {
domain_goto($source);
}
}