The closeAccount hook is triggered when a user closes his account. It passes the user ID, the operation mode and the module as arguments and does not expect a return value.

The operation mode will either be close_deactivate or close_delete.


  1. int $userId

    ID of the user which closed his account.

  2. string $mode

    The “close account” mode. Either close_deactivate or close_delete.

  3. \Contao\Module $module

    The front end module object. This allows you to retrieve all data from the current tl_module result set.


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

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

class CloseAccountListener
    public function __invoke(int $userId, string $mode, Module $module): void
        // Do something …