1 contact.module contact_form_user_profile_form_alter(&$form, &$form_state)

Implements hook_form_FORM_ID_alter().

Add the enable personal contact form to an individual user's account page.

See also



core/modules/contact/contact.module, line 301
Enables the use of personal and site-wide contact forms.


function contact_form_user_profile_form_alter(&$form, &$form_state) {
  $config = config('contact.settings');
  $form['contact'] = array(
    '#type' => 'fieldset',
    '#title' => t('Contact form'),
    '#weight' => 5,
    '#group' => 'additional_settings',
  $account = $form['#user'];
  $form['contact']['contact'] = array(
    '#type' => 'checkbox',
    '#title' => t('Personal contact form'),
    '#default_value' => isset($account->data['contact']) ? $account->data['contact'] : $config->get('contact_default_status'),
    '#description' => t('Allow other users to contact you via a <a href="@url">personal contact form</a> which keeps your email address hidden. Note that some privileged users such as site administrators are still able to contact you even if you choose to disable this feature.', array('@url' => url("user/$account->uid/contact"))),