Add views relationship from group enabled entities to og_membership entities

Created on 28 August 2022, over 2 years ago
Updated 12 September 2024, 3 months ago

Original Issue

I'm struggling with OG and views. I want to use this module, but it's becoming more obvious that it may not be possible.

The views integrations make little sense. And because it has apparently changed from Drupal 7, past answers to similar questions are outdated. For example, there is constant reference in past documentation to using relationships that do not seem to be available in Drupal 8, such as "OG group: OG group from Node" and "OG group: OG membership from OG group."

This lack of relationships is where things start to fall apart for me. If I create a "content" view, it's easy to display those groups authored by the user. But there's no clear way of also bringing in groups to which that user is a member.

If I create an 'Og:membership' view, I can, strangely, add a field that shows the ID of the group to which the membership belongs, but there is no field for the title of the group. Nor is there a relationship that can be added to pull in the title. The only relationship available in a og:membership view is 'user'. And bringing that in does not open up any relationship that provides access to the group title.

Even creating a view that simply displays the number of members in a group seems to be impossible.

I guess my point is nothing is clear, and I'm pounding my head against a wall. It looks like the module is abandoned, which sucks, because it seems like it's just on the edge of being production ready. And, in comparison with the Group module, this module is more lightweight and appropriate for my use case.

Updated Issue

Since the original post, there was some views support added. However, we still lack the ability to relate og_memberships to group enabled entities. Which would allow you to create a view of all groups a user is a member of or show the membership counts for a list of group nodes.

Proposed Resolution

Create a views relationship to og_memberships from any group enabled entities.

There was work done on this on github. I'm opening a MR here with that work.

For reference, here is the old github issue/PR:
old gitub issue: https://github.com/Gizra/og/issues/752
old github PRs: https://github.com/Gizra/og/pull/756 and https://github.com/Gizra/og/pull/755

✨ Feature request
Status

Needs work

Version

1.0

Component

og.module

Created by

πŸ‡ΊπŸ‡ΈUnited States arlingtonvoicellc

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024