If you go to a space's feature page, like /node/3663/features and you're using, for example, the spaces_contacts sub module, the 'options' in the spaces definition in hook_context_define can get wrongly stripped.

In spaces.module there exists in function spaces_features_form:

  // Generate features form
  foreach (spaces_features() as $id => $feature) {
    if (is_array($feature->spaces['options'])) {
      $options = $feature->spaces['options'];
      if (isset($allowed_options)) {
        foreach ($options as $key => $value) {
          if (($key != 0) && !in_array($key, $allowed_options)) {
            unset($options[$key]);
          }
        }
      }
    }

then, if you look at the 'limit options' key in function spaces_groupmask:

    $spacetype_mask = array(
      'private' => array(
        'label' => t('Private'),
        'limit options' => array(SPACES_PRIVATE),
        'mask' => array(
          'og_selective' => OG_CLOSED,
          'og_directory' => OG_DIRECTORY_NEVER,
          'og_register' => OG_REGISTRATION_ALWAYS,
          'og_private' => OG_PRIVATE_GROUPS_ALWAYS,
        ),
      ),
      'controlled' => array(
        'label' => t('Controlled'),
        'mask' => array(
          'og_selective' => variable_get('spaces_controlled_selective', OG_CLOSED),
          'og_directory' => OG_DIRECTORY_ALWAYS,
          'og_register' => OG_REGISTRATION_ALWAYS,
          'og_private' => OG_PRIVATE_GROUPS_NEVER,
        ),
      ),
      'public' => array(
        'label' => t('Public'),
        'limit options' => array(SPACES_PUBLIC),
        'mask' => array(
          'og_selective' => OG_OPEN,
          'og_directory' => OG_DIRECTORY_ALWAYS,
          'og_register' => OG_REGISTRATION_ALWAYS,
          'og_private' => OG_PRIVATE_GROUPS_NEVER,
        ),
      ),
    );  
  }

you'll see the use of constants SPACES_PRIVATE and SPACES_PUBLIC, which are defined as 1 and 2 respectively. What's happening is spaces features that use the function _spaces_group_options to set the available 'options' on the features settings page define 'private' w/ a key of 1. Then, a module like spaces_contacts, where the module is either enabled or disabled, defines its own 'options' key in the spaces definition like:

'options' => array(
  0 => t('Disabled'), 
  1 => t('Enabled')
),

The end result: if you have a public group, and use the spaces_contacts module, the option 'Enabled' will get unset from the array, because the underlying system assumes 1 is 'private' and 1 is also 'Enabled'

As a work-around for now, the attached patch changes the key for the "Enabled" value in the options array from 1 to 2. I know there's plans at some point to revisit all this, so in the meantime, I've just got this simple workaround to keep things working.

Comments

yhahn’s picture

Status: Needs work » Fixed

Thanks Ian -- I've merged this one in.

This is definitely one to think about ... I think in the short run the answer is going to be to mask features that are associated with OG-enabled content types and exclude all others... since if a feature isn't associated with OG nodetypes the mask settings don't make any sense.

How does this sound?

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.