From: Anthony Talarico Date: Thu, 15 Jun 2017 20:01:40 +0000 (-0400) Subject: adding event confirmation required page with default content X-Git-Tag: v1.6.47^2~5 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=65d5f84059bdf7718338eeeff778a913bb2597a1;p=WP-Plugins%2Fglm-member-db-events.git adding event confirmation required page with default content redirecting user to event confirmation page instead of the changing the view to the confirmation page. adding conditional to check for categories array before trying to loop through them in the frontAdd model. --- diff --git a/models/front/events/frontAdd.php b/models/front/events/frontAdd.php index 760600b..af6acf7 100644 --- a/models/front/events/frontAdd.php +++ b/models/front/events/frontAdd.php @@ -201,6 +201,7 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents $eventAmenities = array(); $venues = false; $startTimeOnly = 0; + $eventCategories = []; if ( isset( $actionData['request']['member_only'] ) && $memberOnly = filter_var( $actionData['request']['member_only'], FILTER_VALIDATE_BOOLEAN ) ) { @@ -246,8 +247,10 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents $emailNotification = ( isset($emailInfo['email_notification']) ? $emailInfo['email_notification'] : '' ); $cats = $categories->getList(); - foreach($cats as $cat){ - $eventCategories[] = $cat; + if( !empty($cats) ){ + foreach($cats as $cat){ + $eventCategories[] = $cat; + } } // Load recurrences class @@ -256,13 +259,17 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents //Load Events class $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); + // 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'; +// $view = 'confirmation'; + header("Location: $redirect_url"); /* Redirect browser */ } else { // parse dates and times date_default_timezone_set('America/New_York'); @@ -656,8 +663,8 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents // remove the filter to avoid conflicts remove_filter( 'wp_mail_content_type', 'set_content_type' ); } - - $view = 'confirmation'; +// $view = 'confirmation'; + header("Location: $redirect_url"); /* Redirect browser */ } } diff --git a/setup/requiredPages.php b/setup/requiredPages.php index 025bb1c..0fa332d 100644 --- a/setup/requiredPages.php +++ b/setup/requiredPages.php @@ -57,5 +57,14 @@ $glmMembersEventsRequiredPages = array( 'content' => '[glm-members-event-detail]', 'parent' => '0', 'underscored_title' => 'event_detail_id', + ), + '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

+
', + 'parent' => '0', + 'underscored_title' => 'event_confirmation_id', ) ); diff --git a/views/front/events/confirmation.html b/views/front/events/confirmation.html index 7dde154..5038719 100644 --- a/views/front/events/confirmation.html +++ b/views/front/events/confirmation.html @@ -6,10 +6,5 @@

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

-