Problem/Motivation

When browsing to /user/register to register a new user, I get the following error:

Error: Call to a member function id() on null in Drupal\crm\Hook\UserHooks->userFormAlter() (line 128 of modules/contrib/crm/src/Hook/UserHooks.php).

Steps to reproduce

- Enable the "display_name" settings in user contact mapping settings
- Log out and browse to /user/register

Issue fork crm-3567995

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

svendecabooter created an issue. See original summary.

svendecabooter’s picture

Status: Active » Needs review

This is because the user contact mapping logic that alters the user form, also gets triggered on /user/register, but at that point it doesn't reference a valid user object yet (still needs to be registered at this point).

So I have added an extra check for this now in the MR.

I also moved 2 code blocks higher up, before the entity query, since it would make sense to first do these simple checks, before performing a database query, which is only relevant if the 2 other checks actually pass. If this is not deemed appropriate within the context of this issue, this can be reverted.

bluegeek9 made their first commit to this issue’s fork.

bluegeek9 changed the visibility of the branch 1.0.x to hidden.

bluegeek9’s picture

Status: Needs review » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triage issues and adding more context to existing issues.
  • Flagging CRM as a favorite on the project page to help others discover it and show your support.
  • Review the Developer Docs for accuracy and clarity.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.