You are here

function contact_user in Drupal 5

Same name and namespace in other branches
  1. 4 modules/contact.module \contact_user()
  2. 6 modules/contact/contact.module \contact_user()

Implementation of hook_user().

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

File

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

Code

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' => $edit['contact'],
      '#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' => $edit['contact'],
    );
  }
  elseif ($type == 'insert') {
    $edit['contact'] = variable_get('contact_default_status', 1);
  }
}