You are here

function signup_send_confirmation_mail in Signup 6

Same name and namespace in other branches
  1. 6.2 signup.module \signup_send_confirmation_mail()
  2. 7 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

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

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

Return value

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 1350
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_get_types('name', $node->type);
  $params = array(
    'subject' => t('Signup confirmation for !node_type: !title', array(
      '!node_type' => $node_type_name,
      '!title' => $node->title,
    )),
    'body' => $node->signup_confirmation_email,
    'node' => $node,
    'signup' => $signup,
  );
  if (module_exists('token')) {
    $params['body'] = token_replace_multiple($params['body'], array(
      'node' => $node,
      'signup' => $signup,
      'global' => NULL,
    ));
  }
  $language = user_preferred_language($signup);
  return drupal_mail('signup', 'signup_confirmation_mail', $user_mail, $language, $params);
}