regcode.api.php in Registration codes 6.2
Same filename and directory in other branches
Example hook functions for hooks provided by the core regcode module
File
regcode.api.phpView source
<?php
/**
* @file
* Example hook functions for hooks provided by the core regcode module
*/
/**
* Called when a registration code is used
*/
function hook_regcode_used(&$edit, &$account, &$code) {
if (is_object($code)) {
drupal_set_message(t('Thanks %name, the code %code was used.', array(
'%name' => $account->name,
'%code' => $edit['regcode_code'],
)));
}
}
/**
* Called when validating registration code use
*/
function hook_regcode_validate($edit, $account) {
if (empty($edit['loves_bacon'])) {
form_set_error('regcode_code', t('This just isn\'t working out between us.'));
}
}
/**
* Called when a registration code is loaded
*/
function hook_regcode_load(&$code) {
$code->group = 'foo';
}
/**
* Called to gather field information
*/
function hook_regcode_fields() {
return array(
'group' => array(
'description' => t('The group this code should be assigned to.'),
'title' => t('Group'),
),
);
}
Functions
Name | Description |
---|---|
hook_regcode_fields | Called to gather field information |
hook_regcode_load | Called when a registration code is loaded |
hook_regcode_used | Called when a registration code is used |
hook_regcode_validate | Called when validating registration code use |