function regcode_admin_create in Registration codes 6
Same name and namespace in other branches
- 6.2 regcode.admin.php \regcode_admin_create()
- 7.2 regcode.admin.inc \regcode_admin_create()
- 7 regcode.admin.php \regcode_admin_create()
Create a registration code
Return value
The settings form.
1 string reference to 'regcode_admin_create'
- regcode_menu in ./
regcode.module - Implementation of hook_menu().
File
- ./
regcode.admin.php, line 72 - Functions and pages needed for the administration interface for the regcode module.
Code
function regcode_admin_create() {
$form = array();
// Basics
$form['regcode_create'] = array(
'#type' => 'fieldset',
'#title' => t("Basics"),
'#description' => t('Basic options for the new registration code'),
);
$form['regcode_create']['regcode_create_category'] = array(
'#type' => 'textfield',
'#title' => t("Category"),
'#size' => 30,
'#autocomplete_path' => 'admin/user/regcodes/autocomplete',
'#description' => t('Assign a category for administration purposes, to aid code management.'),
);
$form['regcode_create']['regcode_create_code'] = array(
'#type' => 'textfield',
'#title' => t("Registration code"),
'#description' => t('Leave blank to have code generated. Used as prefix when <em>Number of codes</em> is greater than 1.'),
);
$form['regcode_create']['regcode_create_maxuses'] = array(
'#type' => 'textfield',
'#title' => t("Maximum uses"),
'#default_value' => 1,
'#size' => 10,
'#required' => TRUE,
'#description' => t('How many times this code can be used to register (enter 0 for unlimited).'),
);
$form['regcode_create']['regcode_create_begins'] = array(
'#type' => 'textfield',
'#title' => t("Active from"),
'#description' => t('When this code should activate (leave blank to activate immediately). Accepts any date format that strtotime can handle. Dates should be in between years 1980 and 2030.'),
'#size' => 30,
);
$form['regcode_create']['regcode_create_expires'] = array(
'#type' => 'textfield',
'#title' => t("Expires on"),
'#description' => t('When this code should expire (leave blank for no expiry). Accepts any date format that strtotime can handle. Dates should be in between years 1980 and 2030.'),
'#size' => 30,
);
// Bulk
$form['regcode_create_bulk'] = array(
'#type' => 'fieldset',
'#title' => t("Code generation"),
'#description' => t('Settings used when generating codes'),
);
$form['regcode_create_bulk']['regcode_create_number'] = array(
'#type' => 'textfield',
'#title' => t("Number of codes to generate"),
'#size' => 10,
'#default_value' => 1,
'#description' => t('The number of codes to generate'),
);
$form['regcode_create_bulk']['regcode_create_length'] = array(
'#type' => 'textfield',
'#title' => t("Code size"),
'#size' => 10,
'#default_value' => 10,
'#description' => t('The length of the codes created'),
);
$form['regcode_create_bulk']['regcode_create_format'] = array(
'#type' => 'select',
'#default_value' => variable_get('regcode_generate_format', 'alpha'),
'#title' => t('Format of the generated codes'),
'#options' => array(
'alpha' => t('Letters'),
'numeric' => t('Numbers'),
'alphanum' => t('Numbers & Letters'),
'hexadec' => t('Hexadecimal'),
),
);
$form['regcode_create_bulk']['regcode_create_case'] = array(
'#type' => 'checkbox',
'#title' => t('Uppercase generated codes'),
'#default_value' => variable_get('regcode_generate_case', ''),
);
$form['regcode_create_bulk_submit'] = array(
'#type' => 'submit',
'#value' => t("Create codes"),
);
return $form;
}