// See if there's a hold for this registrant - expired ones should
$holds = $this->wpdb->get_results("
- SELECT *
- FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending
- WHERE registrant = ".$registrant['id']."
+ SELECT *
+ FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending
+ WHERE registrant = ".$registrant['id']."
;", ARRAY_A);
if (count($holds) > 0) {
// Get all expired holds or holds without a matching registrant
$expHolds = $this->wpdb->get_results("
- SELECT *
- FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending
- WHERE expire_time < NOW()
+ SELECT *
+ FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending
+ WHERE expire_time < NOW()
OR registrant NOT IN (
SELECT DISTINCT(id)
FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant
// Get the reg_time entry
$timeData = $this->wpdb->get_row("
- SELECT T.reg_event, T.attendee_max, T.attendee_count, T.attendees_pending, T.attendees_available, E.reg_hold_minutes
- FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time T, ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event E
- WHERE T.id = $timeId
+ SELECT T.reg_event, T.attendee_max, T.attendee_count, T.attendees_pending, T.attendees_available, E.reg_hold_minutes
+ FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time T, ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event E
+ WHERE T.id = $timeId
AND E.id = T.reg_event
;", ARRAY_A);
// SELECT * FROM `items` WHERE `id`= LAST_INSERT_ID()
$regTimePending = $this->wpdb->get_row("
- SELECT * from ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending
- WHERE id = $rtpId
+ SELECT * from ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending
+ WHERE id = $rtpId
;", ARRAY_A);
// Update counts in reg_time record
// Get current time data
$time = $this->wpdb->get_row("
- SELECT attendee_max, attendee_count, attendees_pending, attendees_available
- FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time
- WHERE id = $timeId
+ SELECT attendee_max, attendee_count, attendees_pending, attendees_available
+ FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time
+ WHERE id = $timeId
;", ARRAY_A);
if ($time == null) {
}
+ public function sendHtmlEmail( $to, $subject, $htmlMessage )
+ {
+ // change the default wordpress from name when sending mail
+ add_filter(
+ 'wp_mail_from_name',
+ function ( $name ) {
+ $siteName = get_bloginfo( 'name' );
+ return $siteName;
+ }
+ );
+ // Send confirmation email, set the content type to allow html by using this filter
+ add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) );
+
+ $message = $htmlMessage;
+ $header[] = 'From:' . $this->config['settings']['reg_org_from_email'];
+ $header[] = 'Reply-To:' . $this->config['settings']['reg_org_from_email'];
+
+ wp_mail( $to, $subject, $message, $header );
+
+ // remove the filter to avoid conflicts
+ remove_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) );
+ }
+
+ /**
+ * Set content type of the email.
+ *
+ * Used as filter for the wp_mail_content_type
+ */
+ function set_content_type()
+ {
+ return "text/html";
+ }
+
/*
* Update inventory and send notifications for a cart
* Used after successful checkout to update inventory
* happen at the same time and they both require walking through the cart data.
*
* @param string $summary HTML Summary of checkout for sending to owner and requesting address
- * @param integer $requestId Specify the request ID - not requeired if cart is already loaded
+ * @param integer $requestId Specify the request ID - not required if cart is already loaded
*
* @return null
*
if (trim($emailAddr) != '' && trim($summary) != '') {
$subjectLine = $this->generateHTML($viewData, $regMisc['notify_subject'], true);
$emailMsg = $this->generateHTML($viewData, nl2br($regMisc['notify_text']), true)."\n\n".$summary;
- mail($emailAddr, $regMisc['notify_subject'], $emailMsg);
+ $this->sendHtmlEmail($emailAddr, $regMisc['notify_subject'], $emailMsg);
}
/*
if ($emailAddr != '') {
$subjectLine = $this->generateHTML($viewData, $regMisc['submission_notify_subject'], true);
$emailMsg = $this->generateHTML($viewData, nl2br($regMisc['submission_notify_text']), true)."\n\n".$summary;
- mail($emailAddr, $subjectLine, $emailMsg);
+ $this->sendHtmlEmail($emailAddr, $subjectLine, $emailMsg);
}
}
$viewData['registrant'] = $registrant;
$subjectLine = $this->generateHTML($viewData, $regMisc['registrant_notify_subject'], true);
$emailMsg = $this->generateHTML($viewData, nl2br($regMisc['registrant_notify_text']), true);
- mail($emailAddr, $subjectLine, $emailMsg);
+ $this->sendHtmlEmail($emailAddr, $subjectLine, $emailMsg);
}
}
}
/*
- * Send notifications to contcts listed in event
+ * Send notifications to contacts listed in event
*/
$viewData['event'] = $event;
$eventOther = $RegEvent->getRegEventSimplified($event['reg_event']);
$viewData['eventRegistrants'] = $eventRegistrants;
$subjectLine = $this->generateHTML($viewData, $regMisc['instr_notify_subject'], true);
$emailMsg = $this->generateHTML($viewData, nl2br($regMisc['instr_notify_text']), true);
- mail($emailAddr, $subjectjectLine, $emailMsg);
+ $this->sendHtmlEmail($emailAddr, $subjectjectLine, $emailMsg);
}
}