You are here

function regcode_voucher_form_user_profile_form_alter in Registration codes 7

Same name and namespace in other branches
  1. 7.2 regcode_voucher/regcode_voucher.module \regcode_voucher_form_user_profile_form_alter()

Implements hook_form_FORM_ID_alter().

This adds an extra formset to the user edit page which allows the user to save a code when editing their profile page.

File

regcode_voucher/regcode_voucher.module, line 46
Main code and hooks for regcode voucher module.

Code

function regcode_voucher_form_user_profile_form_alter(&$form, $form_state) {
  $account = $GLOBALS['user'];
  if (!_regcode_voucher_accesscheck($account, 'editform')) {
    return;
  }
  $form['regcode'] = array(
    '#type' => 'fieldset',
    '#title' => check_plain(variable_get('regcode_voucher_fieldset_title', t('Registration Code'))),
  );
  $form['regcode']['regcode_code'] = array(
    '#type' => 'textfield',
    '#title' => variable_get('regcode_voucher_field_title', t('Registration Code')),
    '#description' => check_plain(variable_get('regcode_voucher_field_description', t('Please enter your registration code.'))),
    '#required' => FALSE,
    '#element_validate' => array(
      'regcode_code_element_validate',
    ),
  );
}