You are here

function signup_send_confirmation_mail in Signup 7

Same name and namespace in other branches
  1. 6.2 signup.module \signup_send_confirmation_mail()
  2. 6 signup.module \signup_send_confirmation_mail()

Send the signup comfirmation e-mail to a user who signs up for something.

Note: Each signup-enabled node can be configured to send confirmation e-mails or not, along with the body of the confirmation message to use. If callers wish to honor this configuration, they must test $node->signup_send_confirmation themselves.

Parameters

stdClass $signup: The fully-loaded signup object representing the user's signup.

stdClass $node: The fully-loaded node object which the user signed up to.

Return value

array|false The return value from drupal_mail() if the mail is sent, or FALSE if the confirmation was aborted for some reason (node not configured to send it, user doesn't have a valid e-mail address, etc).

See also

signup_sign_up_user()

drupal_mail()

1 call to signup_send_confirmation_mail()
signup_sign_up_user in ./signup.module
Signs up a user to a node.

File

./signup.module, line 1462
The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…

Code

function signup_send_confirmation_mail($signup, $node) {
  $user_mail = _signup_get_email($signup);
  if (empty($user_mail)) {
    return FALSE;
  }
  $node_type_name = node_type_get_name($node->type);
  $params = array(
    'subject' => token_replace('Signup confirmation for [node:type-name]: [node:title]', array(
      'node' => $node,
      'signup' => $signup,
    )),
    'body' => token_replace($node->signup_confirmation_email, array(
      'node' => $node,
      'signup' => $signup,
      'global' => NULL,
    )),
    'node' => $node,
    'signup' => $signup,
  );
  $language = user_preferred_language($signup);
  return drupal_mail('signup', 'signup_confirmation_mail', $user_mail, $language, $params);
}