You are here

function _spaces_enforce_feature in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_og.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_nodeapi in ./spaces.module
Implentation of hook_nodeapi

File

./spaces.module, line 874

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_PRIVATE:
          $node->og_public = OG_VISIBLE_GROUPONLY;
          break;
        case SPACES_PUBLIC:
          $node->og_public = OG_VISIBLE_BOTH;
          break;
      }
      $node->og_groups = array(
        $gid => $gid,
      );
    }
  }
}