You are here

function contact_user_page in Drupal 5

Same name and namespace in other branches
  1. 6 modules/contact/contact.pages.inc \contact_user_page()

Personal contact page.

1 string reference to 'contact_user_page'
contact_menu in modules/contact/contact.module
Implementation of hook_menu().

File

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

Code

function contact_user_page() {
  global $user;
  if ($account = user_load(array(
    'uid' => arg(1),
  ))) {
    if (!valid_email_address($user->mail)) {
      $output = t('You need to provide a valid e-mail address to contact other users. Please update your <a href="@url">user information</a> and try again.', array(
        '@url' => url("user/{$user->uid}/edit"),
      ));
    }
    else {
      if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
        $output = t('You cannot contact more than %number users per hour. Please try again later.', array(
          '%number' => variable_get('contact_hourly_threshold', 3),
        ));
      }
      else {
        drupal_set_title(check_plain($account->name));
        $output = drupal_get_form('contact_mail_user', $account);
      }
    }
    return $output;
  }
  else {
    drupal_not_found();
  }
}