function _signup_get_email_tokens in Signup 5.2
Same name and namespace in other branches
- 6.2 signup.module \_signup_get_email_tokens()
- 6 signup.module \_signup_get_email_tokens()
- 7 signup.module \_signup_get_email_tokens()
Helper function that returns an array of tokens for signup emails.
These are the hard-coded tokens provided by signup.module which are available even when token.module is not enabled.
Parameters
$node: An object with info about the signup-enabled node. Must contain at least 'nid', 'title', and 'TODO: time?' fields.
$signup: An object with info about the user who signed up.
Return value
An array of tokens and their replacement values.
3 calls to _signup_get_email_tokens()
- signup_broadcast_form_submit in ./
signup.module - Send an email message to all those signed up to a node.
- signup_sign_up_user in ./
signup.module - Signs up a user to a node.
- _signup_cron_send_reminders in ./
signup.module - Helper function that sends cron-based reminder e-mails.
File
- ./
signup.module, line 2892 - 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_get_email_tokens($node, $signup) {
// Tokens about the node itself are easy and don't require any logic.
$tokens = array(
'%node_title' => $node->title,
'%node_url' => url('node/' . $node->nid, NULL, NULL, TRUE),
'%node_start_time' => signup_format_date($node),
);
// Tokens about the user are harder, since we need to potentially do
// things differently for anonymous vs. authenticated signups, and
// might want to do other processing on the signup form data.
// Get the array of custom signup data (if any).
$signup_data = array();
if (!empty($signup->form_data)) {
if (is_array($signup->form_data)) {
$signup_data = $signup->form_data;
}
else {
$signup_data = unserialize($signup->form_data);
}
$tokens['%user_signup_info'] = theme('signup_email_token_custom_data', $signup_data);
}
else {
$tokens['%user_signup_info'] = '';
}
// Determine if this is an anon signup or not, and get the right info.
if (!empty($signup->anon_mail)) {
$tokens['%user_mail'] = $signup->anon_mail;
$tokens['%user_name'] = theme('signup_email_token_anonymous_username', $signup_data, $signup->anon_mail);
}
else {
$tokens['%user_mail'] = $signup->mail;
$tokens['%user_name'] = $signup->name;
}
return $tokens;
}