$createSuccess = false;
$email = false;
$token = false;
+ $sendFormSubmit = false;
$members = array();
$membersWithEmails = array();
$memberEmails = array();
$view = 'passwordReset.html';
break;
case 'moreinfo':
+ // echo '<pre>$_SESSION: ' . print_r( $_SESSION, true ) . '</pre>';
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
// 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"]' );
'email' => $email,
'token' => $token,
'helpUrl' => GLM_MEMBERS_ITINERARY_PLUGIN_URL . 'templates/helpme.html',
+ 'sendFormSubmit' => $sendFormSubmit,
);
error_reporting(E_ALL ^ E_NOTICE);
<h1>Your Trip Planner List</h1>
-<p>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.</p>
-<p>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.</p>
-
-{if count($membersNoEmails) > 0}
+{if !$sendFormSubmit}
+ <p>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.</p>
+ <p>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.</p>
+{/if}
+
+{if count($membersNoEmails) > 0 && !$sendFormSubmit}
<h2>Request Information by Phone From:</h2>
<p>These business listings have no current email address on file. To receive
additional information please call the phone numbers listed next to each
</table>
{/if}
-{if count($membersWithEmails) > 0}
+{if count($membersWithEmails) > 0 && !$sendFormSubmit}
<h2>Request Information by Email From:</h2>
<p>This list of businesses will receive the following information form directly
to their email account.</p>
{/if}
+{if $sendFormSubmit}
+ {$formContents}
+{/if}
<script>
var glm_itinerary_page_url = '{$thisUrl}';