From 759f59c90e83b8cf559a4b0548b410188a3b1c58 Mon Sep 17 00:00:00 2001 From: magepeopleteam Date: Wed, 15 Jan 2020 10:31:41 +0000 Subject: [PATCH] code improved and version 3.0.5 --- inc/admin_setting_panel.php | 6 ++-- inc/mep_event_meta.php | 9 ++++-- inc/mep_extra_price.php | 25 +++++++++++++-- inc/mep_shortcode.php | 14 ++++----- inc/mep_upgrade.php | 36 +++++++++++++++++++--- readme.txt | 8 +++-- templates/single-events.php | 2 ++ templates/template-prts/event_add_cart.php | 5 +-- woocommerce-event-press.php | 4 +-- 9 files changed, 83 insertions(+), 26 deletions(-) diff --git a/inc/admin_setting_panel.php b/inc/admin_setting_panel.php index 3992681..34b3014 100644 --- a/inc/admin_setting_panel.php +++ b/inc/admin_setting_panel.php @@ -143,14 +143,14 @@ class MAGE_Events_Setting_Controls { ) ), array( - 'name' => 'mep_event_expire_on_datetime', + 'name' => 'mep_event_expire_on_datetimes', 'label' => __( 'When will event expire', 'mage-eventpress' ), 'desc' => __( 'Please select when event will expire, On event start time or event endtime', 'mage-eventpress' ), 'type' => 'select', 'default' => 'mep_event_start_date', 'options' => array( - 'event_start_date' => 'Event Start Time', - 'event_end_date' => 'Event End Time' + 'event_start_datetime' => 'Event Start Time', + 'event_end_datetime' => 'Event End Time' ) ), diff --git a/inc/mep_event_meta.php b/inc/mep_event_meta.php index 22762df..23067a0 100644 --- a/inc/mep_event_meta.php +++ b/inc/mep_event_meta.php @@ -1416,8 +1416,8 @@ $event_start_date = strip_tags($_POST['event_start_date']); $event_start_time = strip_tags($_POST['event_start_time']); $event_end_date = strip_tags($_POST['event_end_date']); $event_end_time = strip_tags($_POST['event_end_time']); -// $mep_event_end_date = strip_tags($_POST['mep_event_end_date']); -$mep_event_cc_email_text = strip_tags($_POST['mep_event_cc_email_text']); +// $mep_event_end_date = strip_tags($_POST['mep_event_end_date']); +$mep_event_cc_email_text = $_POST['mep_event_cc_email_text']; $latitude = isset($_POST['latitude']) ? strip_tags($_POST['latitude']) : ""; @@ -1454,13 +1454,16 @@ $mep_reg_tshirtsize_list = update_post_meta( $pid, 'mep_reg_tshirtsize_list $update_template = update_post_meta( $pid, 'mep_event_template', $mep_event_template); $update_mep_org_address = update_post_meta( $pid, 'mep_org_address', $mep_org_address); - +$event_start_datetime = date('Y-m-d H:i:s',strtotime($event_start_date.' '.$event_start_time)); +$event_end_datetime = date('Y-m-d H:i:s',strtotime($event_end_date.' '.$event_end_time)); update_post_meta( $pid, 'event_start_date', $event_start_date); update_post_meta( $pid, 'event_start_time', $event_start_time); update_post_meta( $pid, 'event_end_date', $event_end_date); update_post_meta( $pid, 'event_end_time', $event_end_time); +update_post_meta( $post_id, 'event_start_datetime', $event_start_datetime ); +update_post_meta( $post_id, 'event_end_datetime', $event_end_datetime ); $mep_event_ticket_type = get_post_meta($pid, 'mep_event_ticket_type', true); diff --git a/inc/mep_extra_price.php b/inc/mep_extra_price.php index 4af35ce..02c7545 100644 --- a/inc/mep_extra_price.php +++ b/inc/mep_extra_price.php @@ -267,9 +267,30 @@ if(isset($values['event_ticket_qty'])){ }else{ $event_ticket_qty = " "; } + + + + $user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec',12); + $date_format = get_option( 'date_format' ); + $time_format = get_option( 'time_format' ); + $wpdatesettings = $date_format.' '.$time_format; + + if($user_set_format == 12){ + $cart_date = date_i18n( 'Y-m-d h:i A', strtotime( $values['event_cart_date'] ) ); + }elseif($user_set_format == 24){ + $cart_date = date_i18n( 'Y-m-d H:i', strtotime( $values['event_cart_date'] ) ); + }elseif($user_set_format == 'wtss'){ + $cart_date = date_i18n( $wpdatesettings, strtotime( $values['event_cart_date'] ) ); + } + + + + + + $product_id = $values['product_id']; $cart_location = $values['event_cart_location']; - $cart_date = $values['event_cart_date']; + $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' ); if($form_position=='details_page'){ @@ -281,7 +302,7 @@ $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec - + $item->add_meta_data('Date',$cart_date); $item->add_meta_data('Location',$cart_location); $item->add_meta_data('_event_ticket_info',$values['event_ticket_info']); diff --git a/inc/mep_shortcode.php b/inc/mep_shortcode.php index b5334f5..7d78573 100644 --- a/inc/mep_shortcode.php +++ b/inc/mep_shortcode.php @@ -101,7 +101,7 @@ function mep_event_list($atts, $content=null){ $pagination = $params['pagination']; $sort = $params['sort']; $column = $params['column']; - $event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'event_start_date'); + $event_expire_on = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime'); ob_start(); ?>
@@ -145,7 +145,7 @@ foreach ($terms as $_terms) {
0){ $args_search_qqq = array ( 'post_type' => array( 'mep_events' ), - 'paged' => $paged, + 'paged' => $paged, 'posts_per_page' => $show, 'order' => $sort, 'orderby' => 'meta_value', @@ -183,8 +183,8 @@ if($cat>0){ } elseif($org>0){ $args_search_qqq = array ( - 'post_type' => array( 'mep_events' ), - 'posts_per_page' => $show, + 'post_type' => array( 'mep_events' ), + 'posts_per_page' => $show, 'paged' => $paged, 'order' => $sort, 'orderby' => 'meta_value', @@ -229,7 +229,7 @@ elseif($org>0){ while ($loop->have_posts()) { $loop->the_post(); $event_meta = get_post_custom(get_the_id()); -$author_terms = get_the_terms(get_the_id(), 'mep_org'); + $author_terms = get_the_terms(get_the_id(), 'mep_org'); $time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]); $newformat = date_i18n('Y-m-d H:i:s',$time); @@ -253,7 +253,7 @@ if($style == 'grid'){ $columnNumber = 'two_column'; } }else{ - $columnNumber = 'one_column'; + $columnNumber = 'one_column'; } ?> diff --git a/inc/mep_upgrade.php b/inc/mep_upgrade.php index d72fd2c..d2ee3a0 100644 --- a/inc/mep_upgrade.php +++ b/inc/mep_upgrade.php @@ -48,6 +48,34 @@ add_action('admin_init','mep_get_all_order_data_and_create_attendee'); function mep_get_all_order_data_and_create_attendee(){ +if ( get_option( 'mep_event_default_date_update_2020' ) != 'completed' ) { + + $args = array( + 'post_type' => 'mep_events', + 'posts_per_page' => -1 + ); + + $qr = new WP_Query($args); + foreach($qr->posts as $result){ + $post_id = $result->ID; + $mep_start_date = get_post_meta($post_id, 'event_start_date', true); + $mep_start_time = get_post_meta($post_id, 'event_start_time', true); + $mep_end_date = get_post_meta($post_id, 'event_end_date', true); + $mep_end_time = get_post_meta($post_id, 'event_end_time', true); + + $event_start_datetime = date('Y-m-d H:i:s',strtotime($mep_start_date.' '.$mep_start_time)); + $event_end_datetime = date('Y-m-d H:i:s',strtotime($mep_end_date.' '.$mep_end_time)); + + update_post_meta( $post_id, 'event_start_datetime', $event_start_datetime ); + update_post_meta( $post_id, 'event_end_datetime', $event_end_datetime ); + } + update_option( 'mep_event_default_date_update_2020', 'completed' ); + //die(); +} + + + + if ( get_option( 'mep_event_default_date_update_20' ) != 'completed' ) { $args = array( @@ -61,10 +89,10 @@ if ( get_option( 'mep_event_default_date_update_20' ) != 'completed' ) { $mep_start_date = get_post_meta($post_id, 'mep_event_start_date', true); $mep_end_date = get_post_meta($post_id, 'mep_event_end_date', true); - $event_start_date = date('Y-m-d',strtotime($mep_start_date)); - $event_start_time = date('H:i',strtotime($mep_start_date)); - $event_end_date = date('Y-m-d',strtotime($mep_end_date)); - $event_end_time = date('H:i',strtotime($mep_end_date)); + $event_start_date = date('Y-m-d',strtotime($mep_start_date)); + $event_start_time = date('H:i',strtotime($mep_start_date)); + $event_end_date = date('Y-m-d',strtotime($mep_end_date)); + $event_end_time = date('H:i',strtotime($mep_end_date)); update_post_meta( $post_id, 'event_start_date', $event_start_date ); update_post_meta( $post_id, 'event_start_time', $event_start_time ); diff --git a/readme.txt b/readme.txt index 80ca99b..636a936 100644 --- a/readme.txt +++ b/readme.txt @@ -457,7 +457,9 @@ A. you can create support ticket here with problem details with possible screens 02 Jan 2020* -*= 3.0.4 = +*= 3.0.5 = * Update Release: -==> Date Issue Fixed -13 Jan 2020* \ No newline at end of file +==> Code Improved +==> Date Issue Fixed in Event List +==> Email HTML support issue fixed +15 Jan 2020* \ No newline at end of file diff --git a/templates/single-events.php b/templates/single-events.php index 302cf74..70426db 100644 --- a/templates/single-events.php +++ b/templates/single-events.php @@ -30,6 +30,8 @@ $currency_pos = get_option( 'woocommerce_currency_pos' ); ?>
+
+
diff --git a/templates/template-prts/event_add_cart.php b/templates/template-prts/event_add_cart.php index c016f0d..2d9fa48 100644 --- a/templates/template-prts/event_add_cart.php +++ b/templates/template-prts/event_add_cart.php @@ -6,7 +6,8 @@ function mep_get_event_reg_btn(){ global $post,$event_meta; $post_id = $post->ID; $event_meta = get_post_custom($post_id); - $event_expire_date = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]; + $event_expire_on = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime'); + $event_expire_date = $event_meta[$event_expire_on][0]; $event_sqi = $event_meta['mep_sqi'][0]; $mep_full_name = strip_tags($event_meta['mep_full_name'][0]); $mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]); @@ -93,7 +94,7 @@ $interval = date_diff($datetime2, $datetime1); if(strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)){ ?> - + "; if($email_body){ - $sent = wp_mail( $sent_email, $email_sub, $email_body, $headers ); + $sent = wp_mail( $sent_email, $email_sub, nl2br($email_body), $headers ); } }