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.


  1. int $userId

    Unique ID of the user.

  2. 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).

  3. \Contao\Module $module

    The front end module instance executing this hook.


// src/EventListener/CreateNewUserListener.php
namespace App\EventListener;

use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\Module;

class CreateNewUserListener
    public function __invoke(int $userId, array $userData, Module $module): void
        // Do something …