No default membership in subgroups?

Created on 25 July 2024, 7 months ago
Updated 6 August 2024, 7 months ago

Hello there!

I'm coming from using the Subgroup module (subgroup, not ggroup) and I'm already so happy I did the swap, seems this module isn't doing all the "weird extra stuff" that Subgroup does, and also no errors so far :) But I do have a question:

Let's say I have set up two group types, "Parent" and "Child". I have configured both to automatically set the group creator as member and as admin, as well as provide the default roles etc. When I create Parent or Child group separately, all this works fine.

However, when I create a Child as a subgroup of the Parent, using the group operations inside the Parent, the creator is not added by default as the member of the Child. Is this intended behaviour? If so, why is that? Is there a reason the Child group type settings aren't "respected", specifically when creating it as a subgroup?

I'm sure I can programmatically add the creator as member/admin of the subgroup, but was just wondering why it is not doing so if the group type settings are set that way? Is it actually something that has been overwritten in this module intentionally, or is it just something that isn't implemented and requires that custom code? Would there be some easy way to make the subgroups respect the group type settings on creation, or is it required to just make it via custom hooks/code?

💬 Support request
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

🇫🇮Finland phonkala

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @phonkala
  • 🇧🇪Belgium lobsterr

    It should do it, let me check this

  • 🇫🇮Finland phonkala

    Hey there @LOBsTerr!

    Have you had any time to check this out? I did a clean Drupal 10 install with just Group, this module (ggroup) and Views enabled and I'm experiencing same issue there, when creating subgroup the default membership just isn't created. I tested same with the Subgroup module (subgroup) too (the one I used earlier) and same issue there too, with clean install.

    Could there be some limitation with the actual Group module that causes this? Just feels like something is missing, or maybe it's just me :) I tried enabling absolutely every permission in Parent and Child groups, and in admin > people > permissions, and still it's not creating the subgroup default membership. AND even enabled all the possible content plugins for both groups, but nothing changed.

  • 🇧🇪Belgium lobsterr

    Hi, I am sorry for the delay, I have completely forgotten to check it.
    So, I have checked and it works as expected on my side.
    I assume you didn't check the property "The group creator automatically becomes a member" for your subgroup type.

    Please check /admin/group/types/manage/[YOU_SUBGROUP_TYPE]

  • 🇫🇮Finland phonkala

    Hey!

    No that's the first thing I checked. Actually I got all the checkboxes checked, when creating/managing a group type, for all of my group types.

    Did you create the subgroup directly from the Group UI or as a subgroup of existing parent group via the group operations? If I create the subgroup just via the Group UI directly (then it has no parent group), the membership is created. But if I open a Parent group first and then create a Child group via group operations, the membership is never created. Just checked this with my original project and with the fresh Drupal 10 install, both act the same way.

  • 🇧🇪Belgium lobsterr

    This module doesn't not affect this functionality at all. It purely depends on this property "Group creator must complete their membership" of group module. Check Group entity postSave method.

    It doesn't matter if you use different group types or the same. For a child group type this property must be checked.
    I have checked again with different group types. It works as expected.

    I don't know why it doesn't work on your side. Please check your code for the hooks. I use in my case the clean instance of the Drupal.

  • 🇫🇮Finland phonkala

    It purely depends on this property "Group creator must complete their membership" of group module.

    I guess you mean "The group creator automatically becomes a member"?

    I made 20+ combinations of Parent and Child groups to test this with different settings, even added relationship fields for some combinations, and for me the Child group default membership is only created when:

    1. The Child group type has the option "The group creator automatically becomes a member" checked.
    2. AND the Child group type DOES NOT HAVE the option "Group creator must complete their membership" checked.

    I did a new, fresh Drupal 10 install just before testing this, but this is exactly how it behaves in my actual Drupal project too. There is no custom code related to this, and obviously not in the fresh Drupal install either. The "Group creator must complete their membership" option in the Parent (group) > Content > Subgroup (plugin) did not matter at all.

    So for me the issue was having that "Group creator must complete their membership" checked for all my group types. I didn't need it at all, but had it checked just in case I sometime in the future decide to add fields to the relationships. So currently, I managed to get it working just by unchecking "Group creator must complete their membership", as I don't need it at all now. Obviously, for all my groups, I do have the option "The group creator automatically becomes a member" enabled (I think there might have been some confusion with those two options in last comments).

    But ye, I got it working so no issue for me anymore. But if having the option "Group creator must complete their membership" checked should not interfere with creating the subgroup memberships, there might be something wrong. Though, I experienced this exact behaviour with Subgroup (subgroup) module too, tested that too yesterday and it behaves exactly same way than this module when it comes to auto-creating those subgroup memberships.

  • Status changed to Closed: works as designed 7 months ago
  • 🇧🇪Belgium lobsterr

    Yes, I meant "The group creator automatically becomes a member" :(

    I believe, it was a confusion, because you have several group types and probably you checked for the parent, but not for the child.
    Anyway, let me know if you have any problems, we will try to find a solution!

Production build 0.71.5 2024