Closed (duplicate)
Project:
Group
Version:
8.x-1.x-dev
Component:
Group (group)
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2017 at 10:22 UTC
Updated:
19 Jul 2019 at 09:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
Jonah Fenn commentedI'm encountering this issue as well.
When I attempt to remove either one of them it gives me a white screen.
In the limited testing that I've done, this has occurred when I'm adding and trying to remove the user-1 account. I'm able to add other accounts that are not user-1 and they add singly. I'm unable to remove any of the users from a group, however.
Comment #3
maticb commentedIssue seems to be with the (src/Entity/Form/)GroupContentForm.php, actions():111, there we have this code:
which produces an array containing ["::submitForm", "::complete", "::save"], where the last two callbacks are the cause of the duplicates.
The issue here seems to be in replacing using array_splice() where the third parameter(length) should be 1?
This fixes the immediate problem, but I do not know if it can break any other forms.
EDIT: @fenns, for the removal issues, you can probably fix it with the patch from here: https://www.drupal.org/project/group/issues/2908830
Comment #4
maticb commentedComment #5
mmbkI had the same problem, and can confirm, that this patch ist solving it.
@maticb many thanks for fixing it :-)
Comment #6
Jonah Fenn commentedTested the patch. It works great.
Thanks for your work @maticb, and also for the tip on the content removal patch!
Comment #7
dravenktest++.
no longer members duplicated when create a new group.
Comment #8
bowevil commentedTested the patch using Drupal 8.4.2 and php 7.0.
No duplicate members when creating a new group or a new user is added to group.
Thanks @maticb.
Comment #9
lblissett commentedYes, i can confirm this. No longer duplicate members with this patch.
Durpal 8.5.3 / PHP 7.1
@maticb: Thanks a lot!
Comment #10
Deno commentedGuess i'm stating the obvious, but this patch has not made it to rc2. that is, the bug persists in this pre-release.
Comment #11
kristiaanvandeneyndeThis patch could do with a test that confirms it is broken now and is fixed after the patch is applied.
As far as I can remember, we need the order of submit handlers to be
["::submitForm", "::complete", "::save"], because:So removing complete() from the submit handlers is ill-advised as it will break the linking of the group content.
Comment #12
kristiaanvandeneyndeHere we go, this shows where it goes wrong. Now we need to figure out why.
Comment #14
kristiaanvandeneyndeThe offending code is in Group::postSave()
This means the complete handler saves the group (which creates the member) and then creates the member again in the save handler.
Comment #15
kristiaanvandeneyndeThis should fix it, but introduces a behavioral BC break, so I'm not too sure about this.
Comment #17
maticb commented@kristiaanvandeneynde, if you say that the "::complete" step cannot be removed, then what was the prupose of this code in the first place?
it doesn't really do anything, so I assume you can remove it then?
Comment #18
kristiaanvandeneyndeIt adds ::complete to the array after $index position, see the last bit of example #1 of array_splice(): http://be2.php.net/manual/en/function.array-splice.php
Comment #19
phjouI had the same problem and it occurs on the 8-x-2-x branch when you check both "The group creator automatically becomes a member" and "Group creator must complete their membership".
It makes sense in a way, you add the creator automatically as a member and you also have to complete the membership. We should probably just check that the complete membership option is not enabled before creating automatically the membership of the creator.
I disabled one of the feature in order to avoid the bug.
Comment #20
lobsterr commentedI think we have a duplication here #3016197: "Group creator must complete their membership" Wizard duplicates membership
I have proposed a solution https://www.drupal.org/files/issues/2019-03-01/group_membership_duplicat...
I add setCreatorGetsMembership method which controls whether we should create a user or not. Basically, I set it to false, when we use a wizard.
Comment #21
alxshell commented#19 is fixing it. Thx @phjou
Comment #22
lobsterr commentedI'm closing this issue as duplicate. kristiaanvandeneynde proposed a nice solution in #3016197: "Group creator must complete their membership" Wizard duplicates membership