From: Chuck Scott Date: Tue, 19 Jun 2018 21:04:37 +0000 (-0400) Subject: Filling out merge tags for messages set in settings for registrations and tested... X-Git-Tag: v1.0.4^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=03014af2ea6fe189adcba587e4155ac62de3634d;p=WP-Plugins%2Fglm-member-db-registrations.git Filling out merge tags for messages set in settings for registrations and tested messages again Also updated checkout datat to provide already input data for Register New Account form after checkout --- diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index c41b91f..a4f9d65 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -1400,10 +1400,31 @@ class GlmRegCartSupport $RegMisc = new GlmDataRegistrationsMisc($this->wpdb, $this->config); $regMisc = $RegMisc->getEntry(1); + + // Set view data for site owner, person submitting the event and the event contacts + $account = $this->cart['accounts'][$this->cart['request']['account']]; + $viewData = array( - 'events' => $this->cart['events'], - 'summary' => $summary + 'SubmittedByFirstName' => $account['fname'], + 'SubmittedByLastName' => $account['lname'], + 'SubmittedByTitle' => $account['title'], + 'SubmittedByOrganization' => $account['org'], + 'BillingFirstname' => $this->cart['request']['bill_fname'], + 'BillingLastname' => $this->cart['request']['bill_lname'], + 'BillingAddrLine1' => $this->cart['request']['bill_addr1'], + 'BillingAddrLine2' => $this->cart['request']['bill_addr2'], + 'BillingCity' => $this->cart['request']['bill_city'], + 'BillingState' => $this->cart['request']['bill_state'], + 'BillingZIP' => $this->cart['request']['bill_zip'], + 'BillingCountry' => $this->cart['request']['bill_country'], + 'BillingPhone' => $this->cart['request']['bill_phone'], + 'BillingEmailAddress' => $this->cart['request']['bill_email'], + 'DateTimeSubmitted' => $this->cart['request']['date_submitted']['datetime'], + 'PaymentMethod' => $this->cart['request']['pay_method']['name'], + 'Status' => $this->cart['request']['status']['name'], + 'NumberAttendees' => $this->cart['request']['registrants'], + 'Summary' => $summary ); /* @@ -1412,8 +1433,15 @@ class GlmRegCartSupport $emailAddr = $this->config['settings']['reg_org_internal_email']; 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; - $this->sendHtmlEmail($emailAddr, $regMisc['notify_subject'], $emailMsg); + $emailMsg = $this->generateHTML($viewData, nl2br($regMisc['notify_text']), true); + + // If front debug is on and this is a test submission output message to screen rather than send. + if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) { + $this->displayEmailforTesting('Notice to Site Owner', $emailAddr, $regMisc['notify_subject'], $emailMsg); + } else { + $this->sendHtmlEmail($emailAddr, $regMisc['notify_subject'], $emailMsg); + } + } /* @@ -1441,20 +1469,44 @@ class GlmRegCartSupport } } + // For each event foreach ($this->cart['events'] as $event) { + $viewDataEvent = array( + 'EventName' => $event['event_name'], + 'EventTerms' => $event['event_terms'] + ); + $eventRegistrants = array(); // For each class foreach ($event['classes'] as $class) { + $viewDataClass = array( + 'LevelName' => $class['class_name'] + ); + // For each rate foreach ($class['rates'] as $rate) { + $viewDataRate = array( + 'RateName' => $rate['rate_name'] + ); + // For each registrant foreach ($rate['registrants'] as $registrant) { + $viewDataRegistrant = array( + 'AttendeeFirstName' => $registrant['fname'], + 'AttendeeLastName' => $registrant['lname'], + + ); + + // Merge Tags for this data + $viewData2 = array_merge($viewData, $viewDataEvent, $viewDataClass, $viewDataRate, $viewDataRegistrant); + + // Adjust the inventory and hold numbers if (!$doNotUpdateInventory) { $this->updateTimeEntryCounts($registrant['reg_time'], -1, 1); @@ -1478,17 +1530,8 @@ class GlmRegCartSupport $emailAddr = $this->cart['accounts'][$accountId]['contact_email']; } if ($emailAddr != '' && $emailAddr != $submitAddr) { - $vData = array( - 'event' => $event['event_name'], - 'description' => $registrant['reg_event_descr'], - 'fname' => $registrant['fname'], - 'lname' => $registrant['lname'], - 'datetime' => $registrant['non_time_specific'] ? 'any time during event' : 'on '.$registrant['event_time_reformatted'], - 'request_fname' => $this->cart['request']['bill_fname'], - 'request_lname' => $this->cart['request']['bill_lname'] - ); - $subjectLine = $this->generateHTML($vData, $regMisc['registrant_notify_subject'], true); - $emailMsg = $this->generateHTML($vData, nl2br($regMisc['registrant_notify_text']), true); + $subjectLine = $this->generateHTML($viewData2, $regMisc['registrant_notify_subject'], true); + $emailMsg = $this->generateHTML($viewData2, nl2br($regMisc['registrant_notify_text']), true); // If front debug is on and this is a test submission output message to screen rather than semd. if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && $doNotUpdateInventory) { @@ -1499,7 +1542,7 @@ class GlmRegCartSupport } } - $eventRegistrants[] = $registrant; + $eventRegistrants[] = $viewDataRegistrant; } } } @@ -1507,13 +1550,15 @@ class GlmRegCartSupport /* * Send notifications to contacts listed in event */ - $viewData['event'] = $event; + + $viewData2 = $viewDataEvent; + $viewData2['EventAttendees'] = $eventRegistrants; + $eventOther = $RegEvent->getRegEventSimplified($event['reg_event']); $emailAddr = $eventOther['notify_email']; if (trim($emailAddr) != '') { - $viewData['eventRegistrants'] = $eventRegistrants; - $subjectLine = $this->generateHTML($viewData, $regMisc['instr_notify_subject'], true); - $emailMsg = $this->generateHTML($viewData, nl2br($regMisc['instr_notify_text']), true); + $subjectLine = $this->generateHTML($viewData2, $regMisc['instr_notify_subject'], true); + $emailMsg = $this->generateHTML($viewData2, nl2br($regMisc['instr_notify_text']), true); // If front debug is on and this is a test submission output message to screen rather than semd. if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && $doNotUpdateInventory) { diff --git a/models/front/registrations/checkoutProcess.php b/models/front/registrations/checkoutProcess.php index aaa3c03..22995bc 100644 --- a/models/front/registrations/checkoutProcess.php +++ b/models/front/registrations/checkoutProcess.php @@ -189,6 +189,17 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport // Otherwise this is a guest so try to create the account using the submitted data } else { + // Since there's no account yet, we'll use the billing data for the base account data + $_REQUEST['fname'] = $_REQUEST['bill_fname']; + $_REQUEST['lname'] = $_REQUEST['bill_lname']; + $_REQUEST['addr1'] = $_REQUEST['bill_addr1']; + $_REQUEST['addr2'] = $_REQUEST['bill_addr2']; + $_REQUEST['city'] = $_REQUEST['bill_city']; + $_REQUEST['state'] = $_REQUEST['bill_state']; + $_REQUEST['zip'] = $_REQUEST['bill_zip']; + $_REQUEST['country'] = $_REQUEST['bill_country']; + $_REQUEST['phone'] = $_REQUEST['bill_phone']; + // Create the new account $regAccount = $Account->insertEntry(); @@ -196,6 +207,36 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport if ($regAccount) { $accountId = $regAccount['fieldData']['id']; $guestAccount = true; + + $this->wpdb->update( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'account', + array( + 'fname' => $regAccount['fieldData']['bill_fname'], + 'lname' => $regAccount['fieldData']['bill_lname'], + 'addr1' => $regAccount['fieldData']['bill_addr1'], + 'addr2' => $regAccount['fieldData']['bill_addr2'], + 'city' => $regAccount['fieldData']['bill_city'], + 'state' => $regAccount['fieldData']['bill_state'], + 'zip' => $regAccount['fieldData']['bill_zip'], + 'country' => $regAccount['fieldData']['bill_country'], + 'phone' => $regAccount['fieldData']['bill_phone'] + ), + array( 'id' => $accountId ), + array( + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s' + ) + ); + // Now get the account data for editing again + $regAccount = $Account->editEntry($accountId); + } else { $messages[] = 'Unable to create a guest account for this request. Please try again later.'; } @@ -771,7 +812,6 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport 'status' => $this->config['submission_status'], 'misc' => $misc ); - $summary = $this->generateHTML($summaryData, 'front/registrations/summaryStore.html'); // Store this summary in the request reccord @@ -790,9 +830,6 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport // Update inventory totals and send notifications unless this is a test submission $this->checkoutUpdateInventoryAndNotify($summary, false, $doNotClear); - // Send acknowledgement to person submitting request - mail($request['email'], $misc['submission_ack_subject'], $summary); - // If this is a guest submission set a guest account ID so it can be used to create a user account if ($guestAccount) { $_SESSION['glm_reg_guest_account_id'] = $accountId; @@ -821,14 +858,13 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport 'summary' => $summary, 'misc' => $misc, 'reg_account_id' => $accountId, + 'regAccount' => $regAccount, 'states_list' => $this->config['states'], 'country_list' => $this->config['countries'], 'emailError' => $emailError, 'passwordError' => $passwordError, ); - // echo "
".print_r($this->cart,1)."
"; - // Return status, any suggested view, and any data to controller return array( 'status' => true, diff --git a/views/admin/settings/registrationsMisc.html b/views/admin/settings/registrationsMisc.html index e6b1424..d13fc12 100644 --- a/views/admin/settings/registrationsMisc.html +++ b/views/admin/settings/registrationsMisc.html @@ -258,4 +258,79 @@ +{literal} +

Merge Tags useable in E-Mail Notifications

+

+ The tags below may be used in the E-Mail Notifications above to include information from the submission. + This is equivelent to doing "Mail Merge" with a word processor. When including these tags include the + "{", "}", and "$" characters shown with each tag. + The first set of tags may be used in the "Subject" and "E-Mail Text" of any of the E-Mail Notifications above. + Below those are addtional tags that may be used in certain notifications. + Be sure to use the "Curly Braces" symbols '{' and '}' rather than paranthesis for these tags. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Available in All E-Mail Messages
 {$SubmittedByFirstName}First name of person submitting the request.
 {$SubmittedByLastName}Last name of person submitting the request.
 {$SubmittedByTitle}Title of person submitting the request.
 {$SubmittedByOrganization}Organization name for person submitting the request.
 {$BillingFirstname}Billing first name
 {$BillingLastname}Billing last name
 {$BillingAddrLine1}Billing address line 1
 {$BillingAddrLine2Billing address line 2
 {$BillingCity}Billing City
 {$BillingState}Billing State
 {$BillingCountry}Billing Country
 {$BillingPhone}Billing Phone #
 {$BillingEmailAddress}Billing E-Mail Address
 {$DateTimeSubmitted}Date and Time request was submitted
 {$PaymentMethod}Payment Methods
 {$Status}Status of Request
 {$NumberAttendees}Number of {/literal}{$terms.reg_term_attendee_plur_cap}{literal} for all {/literal}{$terms.reg_term_event_plur}{literal}
 {$Summary}Complete summary as shown after checkout. (large HTML)
 
Also available in "Notification to {/literal}{$terms.reg_term_event_cap}{literal} Contacts"
 {$EventName}Name of {/literal}{$terms.reg_term_event_cap}{literal}
 {$EventAttendees}List of {/literal}{$terms.reg_term_attendee_plur}{literal} for the {/literal}{$terms.reg_term_event}{literal}
   +   Example for listing {/literal}{$terms.reg_term_attendee_plur_cap}{literal}
+     {foreach $EventAttendees as $a}{$a.AttendeeFirstName} {$r.AttendeeLastName}
+     {/foreach} +
  {$RegistrantFirstName}
  {$RegistrantLastName}
 
Also available in "Notification to Person Submitting the {/literal}{$terms.reg_term_registration_plur_cap}{literal}"
 
Also available in "Notification to {/literal}{$terms.reg_term_attendee_plur_cap}{literal}"
 {$EventName}Name of {/literal}{$terms.reg_term_event_cap}{literal}
 {$EventTerms}{/literal}{$terms.reg_term_event_cap}{literal} Terms and Conditions
 {$LevelName}{/literal}{$terms.reg_term_registration_cap}{literal} {/literal}{$terms.reg_term_level_cap}{literal} name
 {$RateName}{/literal}{$terms.reg_term_registration_cap}{literal} Rate name
 {$AttendeeFirstName}{/literal}{$terms.reg_term_attendee_cap}{literal} first name
 {$AttendeeLastName}{/literal}{$terms.reg_term_attendee_cap}{literal} last name
 
Also available in "Acknowledgement to Person Submitting the {/literal}{$terms.reg_term_registration_plur_cap}{literal}"
 
Also available in "Acknowledgement to {/literal}{$terms.reg_term_attendee_plur_cap}{literal}"
 
+{/literal} + {include file='admin/settings/footer.html'} \ No newline at end of file diff --git a/views/front/registrations/summary.html b/views/front/registrations/summary.html index c782cf1..19ddaca 100644 --- a/views/front/registrations/summary.html +++ b/views/front/registrations/summary.html @@ -53,27 +53,27 @@
- +
@@ -81,7 +81,7 @@
@@ -89,16 +89,18 @@ State
@@ -108,9 +110,11 @@ Country diff --git a/views/front/registrations/summaryStore.html b/views/front/registrations/summaryStore.html index 60482e1..438d590 100644 --- a/views/front/registrations/summaryStore.html +++ b/views/front/registrations/summaryStore.html @@ -86,9 +86,6 @@ -
- {$misc.submission_ack_text} -

Checkout Summary