-
Notifications
You must be signed in to change notification settings - Fork 133
Default argument for current user memberships #565
Conversation
Please help me understand how to create a view which shows all the groups (nodes) to which a user is a member. The view should be visible to anyone who views that user's profile. I have applied this patch and created a view of group nodes. I can show the Group nodes created by a user by adding user id contextual filter. But beyond that, I cannot figure out how to filter it to show the group nodes that user has authored and those that they are members of (but didn't author). I have played around with the functionality of this patch, but I am stuck. I see other questions asking for the same thing and none have been answered clearly. |
if (!empty($contexts['og']) && $group = $contexts['og']->getContextValue()) { | ||
if ($group instanceof ContentEntityInterface) { | ||
return $group; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's return early, instead of indenting the IFs
// the roles held in the corresponding groups, and while it | ||
// is one level too granular, i.e. the context will be more | ||
// fragmented than strictly needed, it works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the "is one level too granular" part. What do you mean here?
Since https://www.drupal.org/project/og/issues/3467694 was merged into the Thank you for contributing to Organic groups module. |
This is a new PR based on #253.