You are here

function private_node_mark_public in Private 6

Same name and namespace in other branches
  1. 7 private.module \private_node_mark_public()

Callback for 'Mark as public' node operation

1 call to private_node_mark_public()
private_set_public_action in ./private.module
Implementation of a Drupal action.
1 string reference to 'private_node_mark_public'
private_node_operations in ./private.module
Implementation of hook_node_operations().

File

./private.module, line 312
A tremendously simple access control module -- it allows users to mark individual nodes as private; users with 'access private content' perms can read these nodes, while others cannot.

Code

function private_node_mark_public($nids) {
  foreach ($nids as $nid) {
    db_query('UPDATE {private} SET private = %d WHERE nid = %d', 0, $nid);
    if (!db_affected_rows()) {
      db_query('INSERT INTO {private} (nid, private) VALUES (%d, %d)', $nid, 0);
    }
  }
}