From: Steve Sutton Date: Wed, 12 Dec 2018 17:20:01 +0000 (-0500) Subject: Updating trip planner for thank you message after form submit. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=a4bddea995c7f4b6c44bdfeb33e44f45e8bc2e47;p=WP-Plugins%2Fglm-member-db-itinerary.git Updating trip planner for thank you message after form submit. After submitting the trip planner send form output the form thank you message. --- diff --git a/models/front/itinerary/list.php b/models/front/itinerary/list.php index a7acff4..b937ab5 100755 --- a/models/front/itinerary/list.php +++ b/models/front/itinerary/list.php @@ -74,6 +74,7 @@ class GlmMembersFront_itinerary_list // extends GlmMembersFront_events_baseActio $createSuccess = false; $email = false; $token = false; + $sendFormSubmit = false; $members = array(); $membersWithEmails = array(); $memberEmails = array(); @@ -315,22 +316,30 @@ class GlmMembersFront_itinerary_list // extends GlmMembersFront_events_baseActio $view = 'passwordReset.html'; break; case 'moreinfo': + // echo '
$_SESSION: ' . print_r( $_SESSION, true ) . '
'; + // echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; // Need to create two list one with emails and one without. - foreach ( $members as $member ) { - if ( $member['email'] && filter_var( $member['email'], FILTER_VALIDATE_EMAIL ) ) { - $membersWithEmails[] = $member; - $memberEmwails[] = $member['email']; - } else if ( $member['phone'] ) { - $membersNoEmails[] = $member; + if ( is_array( $members ) && !empty( $members ) ) { + foreach ( $members as $member ) { + if ( $member['email'] && filter_var( $member['email'], FILTER_VALIDATE_EMAIL ) ) { + $membersWithEmails[] = $member; + $memberEmails[] = $member['email']; + } else if ( $member['phone'] ) { + $membersNoEmails[] = $member; + } } } - if ( count( $membersNoEmails ) == 0 && count( $membersWithEmails ) == 0 ) { + if ( isset( $_REQUEST['send_form_submit'] ) && $sendFormSubmit = filter_var( $_REQUEST['send_form_submit'], FILTER_VALIDATE_BOOLEAN ) ) { + $view = 'moreinfo.html'; + } else if ( count( $membersNoEmails ) == 0 && count( $membersWithEmails ) == 0 ) { $view = 'list.html'; } else { $view = 'moreinfo.html'; } - if ( count( $membersWithEmails ) > 0 ) { - $_GET['member_emails'] = implode( ',', $memberEmwails ); + if ( count( $membersWithEmails ) > 0 || $sendFormSubmit ) { + if ( isset( $memberEmails ) && is_array( $memberEmails ) ) { + $_GET['member_emails'] = implode( ',', $memberEmails ); + } $form_id = $this->config['settings']['send_itinerary_form_id']; if ( isset( $form_id ) && filter_var( $form_id, FILTER_VALIDATE_INT ) ) { $formContents = do_shortcode( '[gravityform id="' . $form_id . '" title="false" description="false"]' ); @@ -375,6 +384,7 @@ class GlmMembersFront_itinerary_list // extends GlmMembersFront_events_baseActio 'email' => $email, 'token' => $token, 'helpUrl' => GLM_MEMBERS_ITINERARY_PLUGIN_URL . 'templates/helpme.html', + 'sendFormSubmit' => $sendFormSubmit, ); error_reporting(E_ALL ^ E_NOTICE); diff --git a/setup/frontHooks.php b/setup/frontHooks.php index de2ac60..12afb34 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -77,6 +77,7 @@ $form_id = ( isset( $config['settings']['send_itinerary_form_id'] ) ) ? $config[ if ( isset( $form_id ) && filter_var( $form_id, FILTER_VALIDATE_INT ) ) { // Send Trip Planner Form action after submission add_action( 'gform_after_submission_' . $form_id, function(){ + $_REQUEST['send_form_submit'] = true; unset( $_SESSION['travel-list'] ); }, 10, 2); } diff --git a/views/front/itinerary/moreinfo.html b/views/front/itinerary/moreinfo.html index bebad0f..8fa0e91 100644 --- a/views/front/itinerary/moreinfo.html +++ b/views/front/itinerary/moreinfo.html @@ -1,15 +1,17 @@

Your Trip Planner List

-

Below is the list of businesses you have added to your Trip Planner. The -form below will be sent to each individual business listing that has an email -address listed with their business listing. For those businesses with no -email address, we have included their phone numbers for you to call directly -and request additional information.

-

These business listings have no current email address on file. To receive -additional information please call the phone numbers listed next to each -business name.

- -{if count($membersNoEmails) > 0} +{if !$sendFormSubmit} +

Below is the list of businesses you have added to your Trip Planner. The + form below will be sent to each individual business listing that has an email + address listed with their business listing. For those businesses with no + email address, we have included their phone numbers for you to call directly + and request additional information.

+

These business listings have no current email address on file. To receive + additional information please call the phone numbers listed next to each + business name.

+{/if} + +{if count($membersNoEmails) > 0 && !$sendFormSubmit}

Request Information by Phone From:

These business listings have no current email address on file. To receive additional information please call the phone numbers listed next to each @@ -32,7 +34,7 @@ business name.

{/if} -{if count($membersWithEmails) > 0} +{if count($membersWithEmails) > 0 && !$sendFormSubmit}

Request Information by Email From:

This list of businesses will receive the following information form directly to their email account.

@@ -55,6 +57,9 @@ business name.

{/if} +{if $sendFormSubmit} + {$formContents} +{/if}