On my drupal site, using the User module, I have added extra fields to the user registration form such as 'Organization'. I notice that this has created a mysql database called 'user__field_organization'.
I am trying to write a custom module which involves creating new users.
At the moment my module creates a new user, with a username, password and email. The code for this (which works fine) is:
$user_data = ['name' => 'John', 'mail' => '[email protected]', 'pass' => 'examplePassword','status' => 1,]; $this->user = $this->user_store->create($user_data);
$this->user_store = $etm->getStorage('user'); )
But I also need to update the extra fields such as Organization but can't work out how to do this.
I have looked at this question: How to programmatically create new user with custom fields?
And I have tried adding
$user_data but it doesn't work.
I have been trying to find out where in the User module a user is created once the registration form is submitted. If I could find that then I could copy what is done there.