You are here

function _site_disclaimer_nodeapi_work in Site Disclaimer 7

Same name and namespace in other branches
  1. 6 site_disclaimer.module \_site_disclaimer_nodeapi_work()
3 calls to _site_disclaimer_nodeapi_work()
site_disclaimer_node_delete in ./site_disclaimer.module
Implements hook_node_delete().
site_disclaimer_node_insert in ./site_disclaimer.module
Implements hook_node_insert().
site_disclaimer_node_update in ./site_disclaimer.module
Implements hook_node_update().

File

./site_disclaimer.module, line 451
This module adds Site Disclaimer to the registration page.

Code

function _site_disclaimer_nodeapi_work($node, $op) {
  $nid = variable_get('site_disclaimer_node_id', '');
  $nids = $nid != '' ? _site_disclaimer_nid_all_translations($nid) : array();
  $nids += variable_get('site_disclaimer_allow_nodes', array());

  // Figure out translation relationships of the node
  if (!empty($node->tnid)) {
    $node_tnid = $node->tnid;
  }
  elseif (!empty($node->translation_source)) {
    $node_tnid = $node->translation_source->tnid ? $node->translation_source->tnid : $node->translation_source->nid;
  }

  //?  if (!$node_tnid) {

  //    $node_tnid = $_GET['translation'];
  //  }
  if (isset($node->nid) && in_array($node->nid, $nids) || !empty($node_tnid) && in_array($node_tnid, $nids)) {
    module_load_include('inc', 'site_disclaimer', 'site_disclaimer.admin');
    _site_disclaimer_prep_allowed_paths($nid, $op == 'delete' ? $node->nid : NULL);
  }
}