This is a quick patch for a small problem in the 2.x branch... If you have more than one group type, Spaces gets the group type name using array_pop, so it will only be correct in one of the cases.

I understand this isn't an issue anymore in 3.x because the whole process for selecting the group has changed.

So I wouldn't call this a backport (because there are too many differences in the way this is handled in 3.x now), but it does seem to fix this issue in 2.x in a not-too-unobtrusive way. I'm just grabbing the $group_type from $space

CommentFileSizeAuthor
#1 spaces_697932_grouptypes.patch693 bytesscottrigby

Comments

scottrigby’s picture

Status: Active » Needs review
StatusFileSize
new693 bytes

tiny patch attached

scottrigby’s picture

One note... If a site has the same og-post-type-feature enabled for more than one og-group-type, then this friendly language doesn't make any sense, and it should just be generic like 'My Groups' instead of 'My !typenames', etc.

But we kept it because we're enabling a different set of og-post-node-type features as a new Spaces preset, for use with each specific og-group-type ('course' posts can be added to 'classroom' groups, 'event' posts can be added to 'event series' groups, etc).

So in addition to the patch above, one other thing that we did was to limit the available options to the current group type. Like this...
Immediately below where $valid_groups gets set in _spaces_og_form_alter_node(), added:

  // Filter $valid_groups to include only the current group type.
  foreach ($valid_groups as $key => $value) {
    if (node_load($key)->type == $type) {
      $valid_type_groups[$key] = $value;
    }
  }

Then replaced every instance of $valid_groups with $valid_type_groups below.

I could add that to the patch (maybe with some xtra logic to see if the feature is enabled for more than one group-type), but i don't want to complicate this since we know new work isn't going to be done on 2.x :)

nigelcunningham’s picture

Please do. I'm just starting to use Spaces - still wrapping my head around it! - but already know I have multiple group types and will need this until spaces 3.0 is ready for use.

jmiccolis’s picture

Status: Needs review » Closed (won't fix)

We're not maintaining 2.x any longer, so I'm setting this to "won't fix".