From: Anthony Talarico Date: Thu, 22 Jun 2017 15:49:00 +0000 (-0400) Subject: removing php header function, adding new file for user confirmation email X-Git-Tag: v1.6.47^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=82525481baaad024b7fe014552c8944a4bf708da;p=WP-Plugins%2Fglm-member-db-events.git removing php header function, adding new file for user confirmation email setting the email function when a user submits an event, created a separate email form view file for the user. Changing the use of php header function to redirect to confirmation page to javascript window location function in the confirmation view file. commented out the wp mail function for the user until it's test working fully --- diff --git a/models/front/events/frontAdd.php b/models/front/events/frontAdd.php index 40d0832..2bfa618 100644 --- a/models/front/events/frontAdd.php +++ b/models/front/events/frontAdd.php @@ -270,16 +270,17 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents $events = new GlmDataEvents($this->wpdb, $this->config ); $newEvent = $events->newEntry(); - $pageID = get_option('glm_members_database_option_event_confirmation_id'); - $redirect_url = get_permalink($pageID); + $confirmation_page_id = get_option('glm_members_database_option_event_confirmation_id'); + $redirect_url = get_permalink($confirmation_page_id); // if form is submitted if ( isset( $_REQUEST['newEvent'] ) && $_REQUEST['newEvent'] == "Add Event" ) { // Check to see if the honey pot caught spam. if ( isset( $_REQUEST['real_email'] ) && $_REQUEST['real_email'] ) { -// $view = 'confirmation'; - header("Location: $redirect_url"); /* Redirect browser */ + $view = 'confirmation'; + +// header("Location: $redirect_url"); /* Redirect browser */ } else { // parse dates and times date_default_timezone_set('America/New_York'); @@ -643,9 +644,11 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php'; $viewFile = 'front/events/ownerEmail.html'; + $userEmailFile = 'front/events/userEmail.html'; // Generate output from model data and view $htmlMessage = $smarty->template->fetch($viewFile); + $userMessage = $smarty->template->fetch($userEmailFile); function set_content_type(){ return "text/html"; @@ -663,18 +666,24 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents $to = $to_email; $subject = 'Event Form Submission'; $message = $htmlMessage; + $userBody = $userMessage; $headers = 'From:' . $fromEmail . "\r\n" . 'Reply-To:' . $contactEmail; $header[] = 'From:' . $fromEmail; - $header[] = 'Reply-To:' . $contactEmail; - + $header[] = 'Reply-To:' . $contactEmail; + wp_mail($to, $subject, $message, $header); - + + $userHeader[] = 'From:' . $to[0]; + $userHeader[] = 'Reply-To: No-Reply@gaslightmedia.com'; + +// wp_mail('anthony@localhost', $subject, $userBody, $userHeader); + // remove the filter to avoid conflicts remove_filter( 'wp_mail_content_type', 'set_content_type' ); } -// $view = 'confirmation'; - header("Location: $redirect_url"); /* Redirect browser */ + $view = 'confirmation'; +// header("Location: $redirect_url"); /* Redirect browser */ } } @@ -684,24 +693,25 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents // Compile template data $templateData = array( - 'members' => $members, - 'venues' => $venues, - 'eventAmenities' => $eventAmenities, - 'memberManager' => $memberManager, - 'memberOnly' => $memberOnly, - 'memberContact' => $memberContact, - 'states' => $this->config['states'], - 'state_def' => $default_state, - 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL, - 'currentUrl' => ((isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), - 'categories' => $eventCategories, - 'fromDate' => $fromDate, - 'event' => $newEvent, - 'permalink' => $permalink, - 'title' => $title, - 'to_email' => $to_email, - 'from_email' => $fromEmail, - 'notification' => $emailNotification, + 'members' => $members, + 'venues' => $venues, + 'eventAmenities' => $eventAmenities, + 'memberManager' => $memberManager, + 'memberOnly' => $memberOnly, + 'memberContact' => $memberContact, + 'states' => $this->config['states'], + 'state_def' => $default_state, + 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL, + 'currentUrl' => ((isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), + 'categories' => $eventCategories, + 'fromDate' => $fromDate, + 'event' => $newEvent, + 'permalink' => $permalink, + 'title' => $title, + 'to_email' => $to_email, + 'from_email' => $fromEmail, + 'notification' => $emailNotification, + 'confirmation_page' => $redirect_url, 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/' ); diff --git a/setup/requiredPages.php b/setup/requiredPages.php index 0fa332d..3a1054a 100644 --- a/setup/requiredPages.php +++ b/setup/requiredPages.php @@ -60,10 +60,7 @@ $glmMembersEventsRequiredPages = array( ), 'Event Confirmation' => array( 'title' => 'Event Confirmation', - 'content' => '
-
Thank you for submitting your event
-

Your submission is currently pending, please allow up to 48 hours for it to be reviewed

-
', + 'content' => 'Thank you for submitting your event, Your submission is currently pending, please allow up to 48 hours for it to be reviewed', 'parent' => '0', 'underscored_title' => 'event_confirmation_id', ) diff --git a/views/front/events/confirmation.html b/views/front/events/confirmation.html index 5038719..fb0beca 100644 --- a/views/front/events/confirmation.html +++ b/views/front/events/confirmation.html @@ -2,9 +2,15 @@
-
Thank you for submitting your event
-

Your submission is currently pending, please allow up to 48 hours for it to be reviewed

+

Processing Form....

+ + diff --git a/views/front/events/userEmail.html b/views/front/events/userEmail.html new file mode 100644 index 0000000..efcbe02 --- /dev/null +++ b/views/front/events/userEmail.html @@ -0,0 +1,42 @@ + + + + + + +

Event Submission Notification

+ + + + + + + + + + + {if $endDate} + + + + + {/if} + {if $startTime} + + + + + {/if} + {if $endTime} + + + + + {/if} +
Event Name:{$name}
Event Start Date: {$startDate}
Event End Date:{$endDate}
Event Start Time:{$startTime}
Event End Time:{$endTime}
+ +
+

Thank you for submitting your event, please allow up to 48 hours for the event to be reviewed.

+
+ + \ No newline at end of file