You are here

function _spaces_enforce_feature in Spaces 6

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.2 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 871

Code

function _spaces_enforce_feature($gid, &$node) {
  $map = spaces_content_types();
  $space = spaces_load('og', $gid);
  $feature_name = $map[$node->type];
  if ($space && $space
    ->feature_access($feature_name)) {
    $privacy = $space->features[$feature_name];
    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,
    );
  }
}