Create a user account via API (programmatically)
Permalink
I would like to use SSO to authenticate and register users on my concrete5 website. When a user successfully authenticates, an object is returned with various details about the user. I would like to create a user account with those details. How can I do this via API?
UserInfo::add seems to be deprecated now :o(
What's the new way of achieving this going forward?
What's the new way of achieving this going forward?
In v8 you do it like so:
You can see the create method here:http://docs.mnkras.com/_registration_service_8php_source.html...
Mike
$create = $this->app->make(RegistrationService::class); $user = $create->create($data);
You can see the create method here:http://docs.mnkras.com/_registration_service_8php_source.html...
Mike
Thanks for this. I solved it earlier this afternoon by piecing disparate posts together ending up with
But your above code is much less ugly.
$userRegistrationService = \Core::make('\Concrete\Core\User\RegistrationServiceInterface'); ... $userinfo = [ 'uName' => $username, 'uEmail' => $email, 'uPassword' => $pass ]; $reg = $userRegistrationService->create($userinfo);
But your above code is much less ugly.
And how then to Validate/Activate the user account?
http://concrete5.org/api/class-Concrete.Core.User.UserInfo.html#_ad...
Quick example :