You are here

function htmlmail_form_user_profile_form_alter in HTML Mail 7.2

Same name and namespace in other branches
  1. 8.2 htmlmail.module \htmlmail_form_user_profile_form_alter()
  2. 7 htmlmail.module \htmlmail_form_user_profile_form_alter()

Implements hook_form_FORM_ID_alter().

File

./htmlmail.module, line 156
Sends system emails in HTML.

Code

function htmlmail_form_user_profile_form_alter(&$form, &$form_state) {
  if ($form['#user_category'] != 'account') {
    return;
  }
  if (!(user_access('choose htmlmail_plaintext') || user_access('administer users'))) {
    return;
  }
  $account = $form['#user'];
  $mail = $form['account']['mail'];
  $form['account']['mail'] = array(
    'mail' => $mail,
    'htmlmail_plaintext' => array(
      '#type' => 'checkbox',
      '#title' => t('Plaintext-only emails'),
      '#default_value' => empty($account->data['htmlmail_plaintext']) ? 0 : 1,
      '#description' => t('The %htmlmail module can send emails with fonts, styles, and other HTML formatting.  If you prefer to receive all your emails in unformatted plain text, select this option.', array(
        '%htmlmail' => 'HTML Mail',
      )),
    ),
  );
}