contact_user

Versions
4.6 – 4.7
contact_user($type, $edit, &$user, $category = NULL)
5 – 6
contact_user($type, &$edit, &$user, $category = NULL)

Implementation of hook_user().

Allows the user the option of enabling/disabling his personal contact form.

Code

modules/contact/contact.module, line 160

<?php
function contact_user($type, &$edit, &$user, $category = NULL) {
  if ($type == 'form' && $category == 'account') {
    $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($edit['contact']) ? $edit['contact'] : FALSE,
      '#description' => t('Allow other users to contact you by e-mail via <a href="@url">your personal contact form</a>. Note that while your e-mail address is not made public to other members of the community, privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('@url' => url("user/$user->uid/contact"))),
    );
    return $form;
  }
  elseif ($type == 'validate') {
    return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
  }
  elseif ($type == 'insert') {
    $edit['contact'] = variable_get('contact_default_status', 1);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.