When the hosting_client_register_user variable is TRUE
And a not-signed-in user submits the hosting signup form with a previously unused email address
A generic error is displayed ("The website encountered an unexpected error")
I have attempted to trace the code and this is what I have found:
hosting_signup_form_submit creates a new client
which calls hosting_client_insert, which calls hosting_client_register_user
Which tries to create a new user through user_save
When user_save invokes the 'presave' hook,
This is hooked into by hosting_client, which calls hosting_client_user_form_submit,
Which tries to insert a record into the hosting_client_user using the user ID
However because this is the presave hook, and the user is new, the user doesn't have an ID yet
So the database rejects the operation because the user column can't be null.
I have found a commit here: https://cgit.drupalcode.org/hosting/commit/client/hosting_client.access....
Which may have had a part in introducing this bug.
Thank you
Comments
Comment #2
helmo commentedThanks, that commit could indeed be the culprit. Moving the hosting_client_user_form_submit() to a presave may need some more thought.
It might be as easy as adding a check: