function signup_node_load in Signup 7
Implements hook_node_load().
File
- ./
signup.module, line 827 - 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_node_load($nodes, $types) {
// Check for a signup for the given nodes.
// If it's a new node, load the defaults.
$result = db_query("SELECT * FROM {signup} WHERE nid IN (:nids)", array(
':nids' => array_keys($nodes),
));
foreach ($result as $signup) {
// Load signup data for both new nodes w/ enabled node types,
// and any existing nodes that are already signup enabled.
if (empty($nodes[$signup->nid]->nid) && variable_get('signup_node_default_state_' . $nodes[$signup->nid]->type, 'disabled') == 'enabled_on' || !empty($nodes[$signup->nid]->nid) && !empty($signup)) {
$nodes[$signup->nid]->signup = 1;
$nodes[$signup->nid]->signup_forwarding_email = $signup->forwarding_email;
$nodes[$signup->nid]->signup_send_confirmation = $signup->send_confirmation;
$nodes[$signup->nid]->signup_confirmation_email = $signup->confirmation_email;
$nodes[$signup->nid]->signup_send_reminder = $signup->send_reminder;
$nodes[$signup->nid]->signup_reminder_days_before = $signup->reminder_days_before;
$nodes[$signup->nid]->signup_reminder_email = $signup->reminder_email;
$nodes[$signup->nid]->signup_close_signup_limit = $signup->close_signup_limit;
$nodes[$signup->nid]->signup_status = $signup->status;
$nodes[$signup->nid]->signup_user_reg_form = $signup->user_reg_form;
if ($nodes[$signup->nid]->nid) {
$nodes[$signup->nid]->signup_total = db_query("SELECT COUNT(*) FROM {signup_log} WHERE nid = :nid", array(
':nid' => $nodes[$signup->nid]->nid,
))
->fetchField();
$nodes[$signup->nid]->signup_effective_total = db_query("SELECT SUM(count_towards_limit) FROM {signup_log} WHERE nid = :nid", array(
':nid' => $nodes[$signup->nid]->nid,
))
->fetchField();
}
}
else {
$nodes[$signup->nid]->signup = 0;
}
}
}