domain_node_save_redirect

Versions
domain
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 acidentally moved. However, the node must be visible on that domain.

Return value

No return value. Issue a drupal_goto() if needed.

Code

./domain.module, line 2026

<?php
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);
  }
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List