You are here

function _spaces_enforce_feature in Spaces 6.2

Same name and namespace in other branches
  1. 5.2 spaces_og.module \_spaces_enforce_feature()
  2. 5 spaces.module \_spaces_enforce_feature()
  3. 6 spaces_og/spaces_og.module \_spaces_enforce_feature()

API function that enforces OG group and privacy settings on a node.

1 call to _spaces_enforce_feature()
spaces_og_nodeapi in spaces_og/spaces_og.module
Implementation of hook_nodeapi().

File

spaces_og/spaces_og.module, line 1055

Code

function _spaces_enforce_feature($gid, &$node) {
  $map = spaces_features_map('node');
  $space = spaces_load('og', $gid);
  if ($space) {
    if (isset($map[$node->type])) {
      $privacy = $space->features[$map[$node->type]];
    }
    else {
      $privacy = $space->group->og_private ? SPACES_OG_PRIVATE : SPACES_OG_PUBLIC;
    }
    switch ($privacy) {
      case SPACES_OG_PRIVATE:
        $node->og_public = OG_VISIBLE_GROUPONLY;
        break;
      case SPACES_OG_PUBLIC:
        $node->og_public = OG_VISIBLE_BOTH;
        break;
    }
    $node->og_groups = array(
      $gid => $gid,
    );
  }
}