createNewUser
The createNewUser hook is triggered when a new front end user registers on the website. It passes the ID of the new user and the data array as arguments and does not expect a return value.
Parameters
int
$userId
Unique ID of the user.
array
$userData
All values which have been submitted on the registration form. Be aware that the user ID is not contained in this array (
$userData['id']
is empty).\Contao\Module
$module
The front end module instance executing this hook.
Example
// src/EventListener/CreateNewUserListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\Module;
#[AsHook('createNewUser')]
class CreateNewUserListener
{
public function __invoke(int $userId, array $userData, Module $module): void
{
// Do something …
}
}