You are here

function _spaces_enforce_feature in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces.module \_spaces_enforce_feature()
  2. 6 spaces_og/spaces_og.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.module
Implementation of hook_nodeapi().

File

./spaces_og.module, line 801

Code

function _spaces_enforce_feature($gid, &$node) {
  $map = spaces_content_types();
  $features = spaces_features($gid);
  if ($feature = $map[$node->type]) {
    if (isset($features[$feature]) && ($privacy = $features[$feature])) {
      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,
      );
    }
  }
}