You are here

function og_save_ancestry in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og.module \og_save_ancestry()
  2. 5 og.module \og_save_ancestry()
  3. 5.2 og.module \og_save_ancestry()
  4. 5.3 og.module \og_save_ancestry()
  5. 5.7 og.module \og_save_ancestry()
  6. 6.2 og.module \og_save_ancestry()
1 call to og_save_ancestry()
og_nodeapi in ./og.module
Implementation of hook_nodeapi().

File

./og.module, line 2290

Code

function og_save_ancestry($node) {
  if (og_is_group_post_type($node->type)) {
    $sql = "DELETE FROM {og_ancestry} WHERE nid = %d";
    db_query($sql, $node->nid);
    if (isset($node->og_groups)) {
      $node->og_groups = array_unique($node->og_groups);
      foreach ($node->og_groups as $gid) {

        // TODOL: rename is_public to og_public in DB.
        $ancestry = array(
          'nid' => $node->nid,
          'group_nid' => $gid,
          'is_public' => !empty($node->og_public),
        );
        drupal_write_record('og_ancestry', $ancestry);
      }
    }
  }
}