You are here

function og_save_ancestry in Organic groups 6.2

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 og.module \og_save_ancestry()

Save affiliations of a group post.

Parameters

$node: Node object.

1 call to og_save_ancestry()
og_nodeapi in ./og.module
Implementation of hook_nodeapi().

File

./og.module, line 2376
Code for the Organic Groups module.

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)) {
      foreach ($node->og_groups as $gid) {
        $ancestry = array(
          'nid' => $node->nid,
          'group_nid' => $gid,
        );
        drupal_write_record('og_ancestry', $ancestry);
      }
    }
  }
}