You are here

function content_access_save_per_node_settings in Content Access 6

Same name and namespace in other branches
  1. 8 content_access.module \content_access_save_per_node_settings()
  2. 5 content_access.module \content_access_save_per_node_settings()
  3. 7 content_access.module \content_access_save_per_node_settings()

Saves custom per node settings in the own content_access table.

3 calls to content_access_save_per_node_settings()
content_access_action_grant_node_permissions in ./content_access.rules.inc
Action implementation: Grant permissions for a node.
content_access_action_revoke_node_permissions in ./content_access.rules.inc
Action implementation: Revoke permissions for a node.
content_access_page_submit in ./content_access.admin.inc

File

./content_access.module, line 387
Content access module file.

Code

function content_access_save_per_node_settings($node, $settings) {
  $count = db_result(db_query('SELECT COUNT(nid) FROM {content_access} WHERE nid = %d', $node->nid));

  // settings exists
  if ($count > 0) {
    db_query("UPDATE {content_access} SET settings = '%s' WHERE nid = %d", serialize($settings), $node->nid);
  }
  else {
    db_query("INSERT INTO {content_access} (nid, settings) VALUES(%d, '%s')", $node->nid, serialize($settings));
  }

  // Make content_access_per_node_setting() use the new settings
  content_access_per_node_setting(NULL, $node, $settings);
}