function contact_form_user_profile_form_alter
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
File
- modules/contact/contact.module, line 215
- Enables the use of personal and site-wide contact forms.
Code
function contact_form_user_profile_form_alter(&$form, &$form_state) { if ($form['#user_category'] == 'account') { $account = $form['#user']; $form['contact'] = array( '#type' => 'fieldset', '#title' => t('Contact settings'), '#weight' => 5, '#collapsible' => TRUE, ); $form['contact']['contact'] = array( '#type' => 'checkbox', '#title' => t('Personal contact form'), '#default_value' => !empty($account->data['contact']) ? $account->data['contact'] : FALSE, '#description' => t('Allow other users to contact you via a <a href="@url">personal contact form</a> which keeps your e-mail 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"))), ); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!contact!contact.module/function/contact_form_user_profile_form_alter/7.x