You are here

function og_save_ancestry in Organic groups 5.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.3 og.module \og_save_ancestry()
  4. 5.7 og.module \og_save_ancestry()
  5. 6.2 og.module \og_save_ancestry()
  6. 6 og.module \og_save_ancestry()
1 call to og_save_ancestry()
og_nodeapi in ./og.module
Implementation of hook_nodeapi().

File

./og.module, line 1976

Code

function og_save_ancestry($node) {
  if (!og_is_omitted_type($node->type)) {
    $sql = "DELETE FROM {og_ancestry} WHERE nid = %d";
    db_query($sql, $node->nid);
    if (is_array($node->og_groups)) {
      foreach ($node->og_groups as $gid) {
        $sql = "INSERT INTO {og_ancestry} (nid, group_nid, is_public) VALUES (%d, %d, %d)";
        db_query($sql, $node->nid, $gid, $node->og_public);
      }
    }
  }
}