You are here

function og_presave_group in Organic groups 6.2

Same name and namespace in other branches
  1. 6 og.module \og_presave_group()

Process group before saving to database.

Parameters

$node: Reference to group node.

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

File

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

Code

function og_presave_group(&$node) {
  if (!empty($node->og_groups_inaccessible)) {

    // Add the inaccessible groups which did not show in Audience selector
    $node->og_groups = (array) $node->og_groups + $node->og_groups_inaccessible;
  }

  /**
   * Change $node->theme to $node->og_theme so it matches node_load(). The node form uses $theme, not $og_theme.
   * If author chose the default theme, then '' is written to DB and group follows changes made by site admin.
   */
  if (isset($node->theme)) {
    $node->og_theme = $node->theme;
  }
  else {
    $node->og_theme = NULL;
  }

  // Keep only the selected groups.
  if (isset($node->og_groups)) {
    $node->og_groups = array_filter($node->og_groups);
  }

  // Support devel module's bulk node generation.
  // Affiliate group posts with group(s). Also populate special group fields.
  if (isset($node->devel_generate)) {
    og_devel_generate($node);
  }
}