You are here

function _spaces_announce_apply_book_perms in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_announce/spaces_announce.module \_spaces_announce_apply_book_perms()

Recursive function to walk a book and propagate OG changes.

Parameters

$node: A skeletal node object, needs the following properties; nid, og_groups, og_public

1 call to _spaces_announce_apply_book_perms()
spaces_announce_nodeapi in spaces_announce/spaces_announce.module
Implementation of hook_nodeapi

File

spaces_announce/spaces_announce.module, line 224

Code

function _spaces_announce_apply_book_perms($node) {
  $result = db_query('SELECT b.nid, n.type FROM {book} b INNER JOIN {node} n ON b.vid = n.vid WHERE parent = %d', $node->nid);
  while ($child = db_fetch_object($result)) {

    // Add groups and privacy setting from parent.
    $child->og_groups = $node->og_groups;
    $child->og_public = $node->og_public;

    // Save new group relations.
    og_save_ancestry($child);

    // Process access changes.
    node_access_acquire_grants($child);

    // Recurse.
    _spaces_announce_apply_book_perms($child);
  }
}