closeAccount

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.

Parameters

  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.

Example

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

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\Module;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;

class CloseAccountListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("closeAccount")
     */
    public function onCloseAccount(int $userId, string $mode, Module $module): void
    {
        // Do something …
    }
}

References