function multiple_email_manage in Multiple E-mail Addresses 2.x
Same name and namespace in other branches
- 6 multiple_email_manage.inc \multiple_email_manage()
- 7 multiple_email_manage.inc \multiple_email_manage()
FormAPI callback for managing an accounts e-mail addresses.
Parameters
unknown_type $form_state:
unknown_type $account:
2 string references to 'multiple_email_manage'
- multiple_email_menu in ./
multiple_email.module - Implements hook_menu().
- multiple_email_menu_alter in ./
multiple_email.module - Implements hook_menu_alter().
File
- ./
multiple_email_manage.inc, line 14 - Callbacks for user management of users e-mail addresses.
Code
function multiple_email_manage($form, &$form_state, $account) {
$form = array();
$addresses = multiple_email_load_addresses($account->uid);
unset($addresses[0]);
$form['#account'] = $account;
$form['addresses']['#tree'] = TRUE;
foreach ($addresses as $email) {
$form['addresses'][$email->eid] = array(
'#email' => $email,
'email' => array(
'#type' => 'item',
'#markup' => $email->email,
),
);
if (user_access('administer multiple emails')) {
$form['addresses'][$email->eid]['confirm'] = array(
'#type' => 'checkbox',
'#title' => t('Confirm this e-mail (<a href="!resend">resend</a>)', array(
'!resend' => url('user/' . $account->uid . '/edit/email-addresses/confirm/' . $email->eid . '/resend', array(
'query' => drupal_get_destination(),
)),
)),
'#default_value' => $email->confirmed,
);
if ($email->primary_address) {
// The primary address can not be un-confirmed.
$form['addresses'][$email->eid]['confirm']['#disabled'] = TRUE;
$form['addresses'][$email->eid]['confirm']['#default_value'] = TRUE;
}
}
}
$form['new'] = array(
'email' => array(
'#prefix' => '<div class="add-new-placeholder">' . t('Add new e-mail') . '</div>',
'#type' => 'textfield',
'#size' => 30,
),
'confirm' => array(
'#prefix' => '<div class="add-new-placeholder"></div>',
'#type' => 'checkbox',
'#title' => t('Confirm this e-mail'),
'#access' => user_access('administer multiple emails'),
),
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}