- Issue created by @antiden
- Status changed to Postponed: needs info
over 1 year ago 8:41am 29 June 2023 - π§πͺBelgium lobsterr
Assume name is custom field you have on group content type for invitation plugin ?
We don't insert any user on submit of this form, I guess some custom code is executed.
I just tested it on the fresh installation it works as it should. Please double check your side - π·πΊRussia antiden
Hi,
ok, find problem. I have installed module: remove_username β and that caused the error, because this module is removing the 'name' (username) field from the user management forms.
Your module is working well.
With regards.
- Status changed to Closed: works as designed
over 1 year ago 10:53am 14 July 2023 - πΊπΈUnited States johnnydarkko
@antiden - What did you end up doing? We're using the same combination of modules. I found that when I remove the presave hook in the remove_username module, the invitation is successfully created. I can't quite figure out what is causing the conflict between this module and the remove_username module...
- πΊπΈUnited States johnnydarkko
Aha! There is no email value in the `$user` object.
The presave is setting a null value to the name...
/** * Implements hook_ENTITY_TYPE_presave(). */ function remove_username_user_presave(UserInterface $user) { $user->setUsername($user->getEmail()); }
- πΊπΈUnited States johnnydarkko
Found that after the group membership is invoked by the ginvite module and is saved into the database, an anonymous user object is passed into a user save call.
Source: `web/modules/contrib/group/src/Entity/GroupRelationship.php line 262.`
Before the anonymous user is saved, the remove_username attempts to copy the email value (in this case, NULL) to the username value, the database error occurs.
I created an issue in the remove_username module that would prevent this from happening: https://www.drupal.org/project/remove_username/issues/3396469 π SQL Error when email is null Active
- πΊπ¦Ukraine blade_ukraine
It's also can happen because of the next issue https://www.drupal.org/project/email_registration/issues/3461071 π Save invite to group for anonymous user by email produce the error. Needs review