You are here

function domain_source_update_nodes in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_source/domain_source.module \domain_source_update_nodes()
  2. 7.3 domain_source/domain_source.module \domain_source_update_nodes()
  3. 7.2 domain_source/domain_source.module \domain_source_update_nodes()

FormAPI function that lets us update access rules.

File

domain_source/domain_source.module, line 164
Creates a source domain for linking to content from other domains.

Code

function domain_source_update_nodes($form_id, $form_values) {

  // If our operation is flagged, then we have to manually change the
  // {node_access} table.  The rest of the process will clear the cache,
  // so this should be a safe operation.
  if ($form_values['operation'] == 'domain') {
    $source = $form_values['domain_source'];
    foreach ($form_values['nodes'] as $key => $value) {
      if ($key == $value) {
        db_query("DELETE FROM {domain_source} WHERE nid = %d", $key);
        db_query("INSERT INTO {domain_source} (nid, domain_id) VALUES (%d, %d)", $key, $source);
      }
    }
  }
}