You are here

function spaces_og_node_presave in Spaces 7.3

Implements hook_node_presave().

1 call to spaces_og_node_presave()
spaces_og_node_prepare in spaces_og/spaces_og.module
Implements hook_node_prepare().

File

spaces_og/spaces_og.module, line 356

Code

function spaces_og_node_presave($node) {
  if (variable_get('og_group_type_' . $node->type, 'omitted') != 'omitted') {

    // TODO verify that this sufficiently replaces the og_is_omitted_type() function.
    $space = spaces_get_space();
    if ($space && $space->type == 'og') {
      _spaces_og_enforce_privacy($space->id, $node);
    }
    else {
      if (!empty($node->og_groups)) {
        _spaces_og_enforce_privacy(current($node->og_groups), $node);
      }
    }
    if (isset($node->spaces_og_audience) && (int) $node->spaces_og_audience !== 0) {
      $node->og_groups[$node->spaces_og_audience] = $node->spaces_og_audience;
    }
  }
}