contact_mail_user_submit

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/contact/contact.module, строка 356

Версии
5
contact_mail_user_submit($form_id, $form_values)
6
contact_mail_user_submit($form, &$form_state)

Process the personal contact page form submission.

Код

<?php
function contact_mail_user_submit($form_id, $form_values) {
  global $user;

  $account = user_load(array('uid' => arg(1), 'status' => 1));
  // Compose the body:
  $message[] = "$account->name,";
  $message[] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", NULL, NULL, TRUE), '!form-url' => url($_GET['q'], NULL, NULL, TRUE), '!site' => variable_get('site_name', 'Drupal')));
  $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", NULL, NULL, TRUE)));
  $message[] = t('Message:');
  $message[] = $form_values['message'];

  // Tidy up the body:
  foreach ($message as $key => $value) {
    $message[$key] = wordwrap($value);
  }

  // Prepare all fields:
  $to = $account->mail;
  $from = $user->mail;

  // Format the subject:
  $subject = '['. variable_get('site_name', 'Drupal') .'] '. $form_values['subject'];

  // Prepare the body:
  $body = implode("\n\n", $message);

  // Send the e-mail:
  drupal_mail('contact-user-mail', $to, $subject, $body, $from);

  // Send a copy if requested:
  if ($form_values['copy']) {
    drupal_mail('contact-user-copy', $from, $subject, $body, $from);
  }

  // Log the operation:
  flood_register_event('contact');
  watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)));

  // Set a status message:
  drupal_set_message(t('The message has been sent.'));

  // Jump to the user's profile page:
  return "user/$account->uid";
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему