Joining a group dumps the user on their account page instead of returning them to the group

Created on 16 June 2018, over 6 years ago
Updated 12 July 2024, 5 months ago

Joining a group should be a wonderful, life changing experience. But it isn't.

  • After choosing to join a group via the group operations block, a user is first redirected to a confirmation page.
  • After they have confirmed their wish to join the group, (for no good reason) they are then dumped on the user account page at /user/[nid]
  • They then have to navigate back to group

After confirming their membership they should be returned to the group.

I am assuming this to be a bug rather than a feature, because leaving a group is quite a pleasant experience and works as expected.

The same thing happens if an administrator creates a new group, and get sent to the user account page, not the new group page.

πŸ› Bug report
Status

Needs review

Version

3.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom mrpauldriver

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

Comments & Activities

Not all content is available!

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

  • πŸ‡³πŸ‡±Netherlands ericmulder1980

    Well it took us 5 years to get to this point. I would suggest we first fix a broken system before we try to improve it. Currently the redirect Url in 3.x is based on the following logic. I really don't want to create a new issue for the 3.x branch so i changed the version of this issue.

    1. If you have view access to the Group Relationship Entity (which is configured in the Group type permissions : View individual group members) you are redirected to the Group relationship entity. This is very confusing for the actual visitors of a website that uses the Group module.
    2. If you have view access to the Entity related to the Group Relationship (which is the user that created the relationship) you will be redirected to the user page.
    3. If you have view access to the Group related to the Group Relationship (which you generally should have since you became a member) you will be redirected to the group page.
    4. If all else fails we will send you to the frontpage

    So the default behaviour is that you will probably never be redirected to the group page. I can't really see a business case where you would not have the "View individual group members" permission OR where you don't have the permission to view your own user page. This logic works very well if you add a node or other entity relation to a group but not for group memberships.

    We can turn this issue into a massive change with configurable redirect paths per group type but that will only further delay the solution of this issue. I think for now we need to make a special flow when we are adding a group membership relation. For all other entity types we can keep the logic as is.

    Please check attached patch for the 3.x version.

  • πŸ‡³πŸ‡±Netherlands ericmulder1980

    Somehow a use statement fell off. New patch provided.

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    This has been annoying me for quite some time too, but I just have never gotten around to it. It's definitely on my list to commit some day, but I feel like we might want to put this logic in a new type of plugin handler that defaults to the current behavior, but can deviate on a per plugin basis.

  • Status changed to Needs review 9 months ago
  • πŸ‡ΈπŸ‡³Senegal diaodiallo

    Thank you @ericmulder1980 I spent almost half a day with this issue and your small code is working perfectly for me.

    Changing the status so more user can test and confirm.

  • If I try to redirect in an hook_form_group_relationship_form_alter hook, my redirect is overwritten.
    Method GroupRelationshipForm::Save is should check for existing redirects before overwriting them

      if (!$form_state->getRedirect()) {
        if ($group_relationship->access('view')) {
          $form_state->setRedirectUrl($group_relationship->toUrl());
        }
          etc...
    
  • πŸ‡©πŸ‡ͺGermany dercheffe Sersheim, Germany

    The Patch in #25 works in 2.2 as well as far I could test.

Production build 0.71.5 2024