You are here

function hook_regcode_used in Registration codes 8

Same name and namespace in other branches
  1. 6.2 regcode.api.php \hook_regcode_used()
  2. 7.2 regcode.api.php \hook_regcode_used()
  3. 7 regcode.api.php \hook_regcode_used()

Called when a registration code is used.

1 invocation of hook_regcode_used()
regcode_code_consume in ./regcode.module
Consumes a regcode and attribute it to a user.

File

./regcode.api.php, line 11
Example hook functions for hooks provided by the core regcode module.

Code

function hook_regcode_used($code, $account) {
  if (is_object($code)) {
    \Drupal::messenger()
      ->addStatus(t('Thanks %name, the code %code was used.', [
      '%name' => $account->name,
      '%code' => $code['code'],
    ]));
  }
}