drupaldrupal-7organic-groups

How to add additional field to drupal organic group 'User and Group' relation?


Im using Drupal Organic group module and I want to create a group and need to assign users (filter by perticular role) to that group. I have done that part easily but the problem is that, I need to add aditional note on per each group user relation.

Lets say there is a group called "School Prefects" and need to add users to that group whos role is student. In here I need to put a small description for each relation. Please help me to figure this out.

Thanks in advance.


Solution

  • I will probably deal with the same problem soon.

    I think a possible workaround is to use the relation module and the rules module. You could set up a rule to create a relation each time a user is assigned to a group, or something like that. Relations made by the relation module are fieldable. But it would be maybe better to add a field to the og user-group relation directly.

    Update: now that I tackled the issue, I have a different solution. We don't need to add new relations, the og_membership shipped standard with og is all that we need. This is how I did it.

    I created a new membership type from admin/config/group/group-membership. It's a fildable entity so I added the required fields: in your case it will be "description".

    Then I changed the used membership type per user, I did it in admin/config/people/accounts/fields/og_user_node (I needed to change the field "group membership" in user account).

    So, now when you (or a group administrator) go to "manage group page" (clicking the group tab in group node), where you can add new people or manage members, either way you can edit your custom field "description" on each membership users-group.

    Besides, you can clone the "og members" view adding the field "description", so in people panel in the group homepage we see name + description.

    I my use-case I had to see (per group member): name, role, start date, end date. E.g. John Doe, president, from 1997 to 2003.