Multiple memberships of same user with different status ?

Created on 2 October 2024, about 2 months ago

Hi,

I have a basic question about group_membership relationship.

I try to build a community system with group module. The system has a "structure" group type. Each structure has a particular type (ie organization, services provider, ...) and can, of course, add / remove members.
In the system, there is multiple kind of user, based on a member-relationship field.

The field allow to choose the kind of relationship that link the user to the structure as member :

  • structure core members
  • service provider (+ entity reference to another structure)
  • volunteer
  • ... (other kind of relationship)

A real example :

The structure X create events, and build an "organization" group, called "organization X".

User A, B and C are "structure core members" of the organization X.

  • User A is founder of the organization
  • User B is community manager of the organization
  • User C is accountant of the organization

Now, User B is already member of another structure, that provide services about events, for example specialized to set up sound system.

On the group administration page, my goal is to display some lists :

  • members -> the structure core members
  • services providers -> the members that are invited as services providers
  • ...

Actually, I see that the group_membership plugin has a cardinality locked to 1. But as I see, we can add members multiple times using code ($group->addRelationship($user, 'group_membership', [ my values... ]);

In this case, I have multiples times the same user as member, but when I try to edit one of these relationships, group save relationship and add new relationships for the same user. Example : I have two time the user C. I edit one of the relation to change some fields values. I save the changes, and now I have 4 time the same user as member.

I tried to change my mindset and build a module with new @GroupRelationType to add structures as "participant" in other structures. In this case, all can work together because only one structure represent a participant, no need to add multiple time the same entity... But if I indicate "group" as entity_type_id, the following error message is displayed :

The "group_participant" plugin defines entity access over group entities. This should be dealt with by altering the group permissions of the current user.

And I don't understand what I can do to avoid this error message, I'm logged as super-admin...

Subgroup is not a solution because a subgroup can't be the same type of it's parent.

If anyone can help me to find a way or give some suggestions to build this kind of system it would be very helpful.

💬 Support request
Status

Active

Version

3.2

Component

Code

Created by

🇨🇭Switzerland titouille

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

Comments & Activities

Production build 0.71.5 2024