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.

Issue fork group-2980034

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

MrPaulDriver created an issue. See original summary.

lobsterr’s picture

StatusFileSize
new1.49 KB

I have updated the logic of redirection. Now, first we check if user can view the group, then group content, then entity and front page
For me it looks also more logical to redirect user first to the group

mrpauldriver’s picture

This works well @LOBsTerr. Thank you for putting in the time.

It would be good to display a status message confirming membership of the group and also something after leaving

"You have successfully joined this group"
"You have successfully left this group"

mrpauldriver’s picture

Upon being redirected to the leave group page, the user is presented with a leave group button, above which is the message "This action cannot be undone."

To me this message is confusing or (subject to permissions) perhaps not true.

I suggest that this message need not be displayed and could be removed.

lobsterr’s picture

Status: Active » Needs review
StatusFileSize
new2.67 KB
new1.18 KB

@MrPaulDriver - Added messages for both cases, when we join and leave the group. You are right, it was missing and confusing for users

mrpauldriver’s picture

Issue summary: View changes
StatusFileSize
new34.35 KB

Status messages work well.

Still not sure about the help text when leaving a group. Do we need "This action cannot be undone"?. To me it sounds too permanent and depending on the groups's permission may not be accurate either.

The options could be;

- Keep as is
- Remove the text completely
- A more helpful message like. "This action will end your membership of the group?"

lobsterr’s picture

@MrPaulDriver It is standard confirmation form message. I will check what can be done about it.

mrpauldriver’s picture

I thought it might be.

In case you had not noticed, I just edited the wording in my post to "This action will end your membership of the group", as my previous suggestion "Are you sure?" already appears in the title.

lobsterr’s picture

mrpauldriver’s picture

Great work.

One tiny detail - my mistake.

This action will end your membership of the group?

is actually is a statement rather than a question, so should not have a question mark

lobsterr’s picture

StatusFileSize
new3.26 KB
mrpauldriver’s picture

Status: Needs review » Reviewed & tested by the community

This is working for me. Thanks to @LOBsTerr

It would be good to see this committed to an RC3 release.

kristiaanvandeneynde’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/src/Entity/Form/GroupContentForm.php
    @@ -126,18 +126,19 @@ class GroupContentForm extends ContentEntityForm {
    +    // can view in the following order: The relationship the group,
    +    // entity (group content), they target entity itself and finally the front
    

    Typo?

  2. +++ b/src/Entity/Form/GroupContentForm.php
    @@ -126,18 +126,19 @@ class GroupContentForm extends ContentEntityForm {
    +    if ($group_content->getGroup()->access('view')) {
    +      $form_state->setRedirectUrl($group_content->getGroup()->toUrl());
    +    }
    +    elseif ($group_content->access('view')) {
           $form_state->setRedirectUrl($group_content->toUrl());
    

    While this might work well for members, it really sucks to create a node in a group and then not see that node. We need something better. Perhaps offload that logic to the plugin?

On a related note, the confirmation messages warrant their own issue. They don't need to be blocked by us finding a solution to the redirects.

lobsterr’s picture

@kristiaanvandeneynde there is an attempt to handle redirection, when we add a node #2817109: How to redirect to the owning group after adding a gnode?. I think it could be useful to have similar settings for the redirection of the user after joining / leaving a group.

The only thing I don't like here we store these settings globally for all group types and not per group type. I was thinking maybe we should have a custom field settings for different custom settings. This field maybe used by other developers by altering the group type form.

I found this approach in message module. It works very well! Anyway, it would be great to have a chance to extend group settings.

mrpauldriver’s picture

Issue summary: View changes
mrpauldriver’s picture

Version: 8.x-1.0-rc2 » 8.x-1.x-dev
dercheffe’s picture

Patch #11 works well for me thx. I agree with #14. It would be a great UX improvement for site builders (and as result also for the end users too) if there are following group settings available per group type

  • Redirect users to group profile page after joining leaving a group - yes/no
  • Redirect users to group profile page after created a group entity like a group node - yes/no. Perhaps here separate settings per entity type
  • Display operations block as normal themeable html list without dropbuttons (see here #3015420: Group operations block collapsed menu items TO simple links)
  • Displaying Join/leave group help text and buttons in a modal dialog window - yes/no
  • Displaying gnode add form in a modal dialog window - yes/no

Just some ideas :)

pp.panatom’s picture

StatusFileSize
new3.29 KB

replaced drupal_set_message() for drupal 9 compatibility

dxvargas’s picture

Component: Group (group) » Code

About the patch in #19:
The description "This action will end your membership of the group" in the GroupContentDeleteForm is not good, since it will applied by default to any group content, not only to group membership content.

For the rest, it seems good.

ressa’s picture

Issue summary: View changes

I tried the Group module the other day, and was also puzzled: After creating a new group as administrator, I was sent to my user account page, and not the new group. The patch works well, and I am sent to the group after creating it, perfect.

Should separate issues be created for the 3.0.x-dev and 2.0.x-dev branches, once the details are settled here?

lobsterr’s picture

I had an idea to move to a separate module and make it configurable per a group. I am afraid it will never be merged in the group module or we will have to wait for ages, what we are actually doing it.
I will check, what could be done, when I finish with migration of group_permissions module

ressa’s picture

Thanks for starting working on this in 2018 @LOBsTerr! Ideally, it shouldn't be necessary to add a module to get what is the expected behavior, in my mind. It surprises me that this behavior has been the default for this long, maybe always? So I hope this issue can move forward, perhaps by focusing on fixing the redirect to the group after joining or creating in this issue, and fix the messages in a separate issue, as suggested in #13?

ericmulder1980’s picture

Version: 8.x-1.x-dev » 3.1.0
StatusFileSize
new1.47 KB

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.

ericmulder1980’s picture

Somehow a use statement fell off. New patch provided.

kristiaanvandeneynde’s picture

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.

Edit: hid the patch by cross-posting :/

diaodiallo’s picture

Status: Needs work » Needs review

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.

matslats’s picture

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...

in fact this is the redirect I would like.

$form_state->setRedirect(
  'entity.group_relationship.collection', 
  [$form_state->getFormObject()->getEntity()->getGroup()->id()]
);
dercheffe’s picture

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

hitchshock’s picture

Version: 3.1.0 » 3.3.x-dev

hitchshock’s picture

Status: Needs review » Reviewed & tested by the community

The issue is still relevant.
I updated #23 patch to make it compatible with 3.3.x and made an MR.

From my side RTBC, cuz it works well.

nagy.balint’s picture

#31 works for me

For me it was an issue where I created a new group, and after going through an extra membership form (which I think is also a UX issue), I got redirected to the membership entity, and not to the group.