From e31f0b7e299aa5459d1d9801195a5a9998e51889 Mon Sep 17 00:00:00 2001 From: magepeopleteam Date: Mon, 20 Mar 2023 05:07:11 +0000 Subject: [PATCH] version 3.8.7 release --- inc/admin_setting_panel.php | 61 ++++++++++++++++++++- inc/mep_functions.php | 82 ++++++++++++++++++++++------ inc/template-prts/event_add_cart.php | 2 +- inc/template-prts/google_map.php | 3 +- woocommerce-event-press.php | 2 +- 5 files changed, 128 insertions(+), 22 deletions(-) diff --git a/inc/admin_setting_panel.php b/inc/admin_setting_panel.php index 548d4d1..6be8975 100644 --- a/inc/admin_setting_panel.php +++ b/inc/admin_setting_panel.php @@ -352,7 +352,62 @@ if (!class_exists('MAGE_Events_Setting_Controls')) : 'yes' => 'Yes', 'no' => 'No' ) - ), + ), + // array( + // 'name' => 'mep_allow_multiple_add_cart_event', + // 'label' => __('Allow multiple Add to Cart of a Single event?', 'mage-eventpress'), + // 'desc' => __('By Default adding to the cart of a single event is disabled. If you want to enable it select Yes', 'mage-eventpress'), + // 'type' => 'select', + // 'default' => 'no', + // 'options' => array( + // 'yes' => 'Yes', + // 'no' => 'No' + // ) + // ), + + array( + 'name' => 'mep_show_hidden_wc_product', + 'label' => __('Show Hidden Woocommerce Products?', 'mage-eventpress'), + 'desc' => __('With every creation of an event there is a Woocommerce product is also created. By default its hidden in the Product list. If you want to show them in the list select Yes', 'mage-eventpress'), + 'type' => 'select', + 'default' => 'no', + 'options' => array( + 'yes' => 'Yes', + 'no' => 'No' + ) + ), + + array( + 'name' => 'mep_google_map_zoom_level', + 'label' => __('Set the Google Map Zoom Level', 'mage-eventpress'), + 'desc' => __('Select the Google Map zoom level. By default is 17', 'mage-eventpress'), + 'type' => 'select', + 'default' => '17', + 'options' => array( + '5' => '5', + '6' => '6', + '7' => '7', + '8' => '8', + '9' => '9', + '10' => '10', + '11' => '11', + '12' => '12', + '13' => '13', + '14' => '14', + '15' => '15', + '16' => '16', + '17' => '17', + '18' => '18', + '19' => '19', + '20' => '20', + '21' => '21', + '22' => '22', + '23' => '23', + '24' => '24', + '25' => '25' + ) + ), + ) ), 'event_list_setting_sec' => apply_filters('mep_settings_event_list_arr', array( @@ -1247,10 +1302,10 @@ function mep_get_option($option, $section, $default = '') { $options = get_option($section); if (isset($options[$option])) { - return $options[$option]; + return esc_html($options[$option]); } - return $default; + return esc_html($default); } diff --git a/inc/mep_functions.php b/inc/mep_functions.php index c27936f..ff2cc05 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -613,6 +613,19 @@ function mep_check_attendee_exist_before_create($order_id, $event_id, $date ='') } } + + +// add_filter('mep_check_product_into_cart', 'mep_beta_disable_add_to_cart_if_product_is_in_cart', 90, 2); +function mep_beta_disable_add_to_cart_if_product_is_in_cart($is_purchasable, $product){ + $all_multiple_cart = mep_get_option('mep_allow_multiple_add_cart_event', 'general_setting_sec', 'no'); + if($all_multiple_cart == 'yes'){ + return true; + } + +} + + + add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 90); add_action('__experimental_woocommerce_blocks_checkout_order_processed', 'mep_event_booking_management', 90); // add_action('woocommerce_blocks_checkout_order_processed', 'mep_event_booking_management', 90); @@ -687,7 +700,10 @@ function mep_check_attendee_exist_before_create($order_id, $event_id, $date ='') $item_quantity = 0; $check_before_create = mep_check_attendee_exist_before_create($order_id,$event_id); mep_attendee_extra_service_create($order_id,$event_id,$_event_extra_service); + mep_delete_attandee_of_an_order($order_id, $event_id); + + foreach ( $event_ticket_info_arr as $field ) { if($field['ticket_qty']>0){ $item_quantity = $item_quantity + $field['ticket_qty']; @@ -696,22 +712,44 @@ function mep_check_attendee_exist_before_create($order_id, $event_id, $date ='') if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){ foreach ($user_info_arr as $_user_info) { $check_before_create_date = mep_check_attendee_exist_before_create($order_id,$event_id, $_user_info['user_event_date']); - // if($check_before_create < count($user_info_arr)){ - // if($check_before_create_date == 0){ + + if(function_exists('mep_re_language_load')){ + mep_attendee_create('user_form',$order_id,$event_id,$_user_info); - // } - // } + + }else{ + + if($check_before_create < count($user_info_arr)){ + if($check_before_create_date == 0){ + mep_attendee_create('user_form',$order_id,$event_id,$_user_info); + } + } + + } + } }else{ foreach($event_ticket_info_arr as $tinfo){ for ($x = 1; $x <= $tinfo['ticket_qty']; $x++) { + + + $check_before_create_date = mep_check_attendee_exist_before_create($order_id,$event_id, $tinfo['event_date']); - // if($check_before_create < count($event_ticket_info_arr)){ - // if($check_before_create_date == 0){ + + if(function_exists('mep_re_language_load')){ + mep_attendee_create('billing',$order_id,$event_id,$tinfo); - // } - // } + + }else{ + if($check_before_create < count($event_ticket_info_arr)){ + if($check_before_create_date == 0){ + mep_attendee_create('billing',$order_id,$event_id,$tinfo); + } + } + } + + } } @@ -742,6 +780,15 @@ function mep_check_attendee_exist_before_create($order_id, $event_id, $date ='') } } + +if (!function_exists('mep_diff_two_datetime')) { + function mep_diff_two_datetime($d1,$d2){ + $timeFirst = strtotime($d1); + $timeSecond = strtotime($d2); + return $differenceInSeconds = $timeSecond - $timeFirst; + } +} + if (!function_exists('mep_delete_attandee_of_an_order')) { function mep_delete_attandee_of_an_order($order_id, $event_id) { @@ -759,14 +806,9 @@ function mep_delete_attandee_of_an_order($order_id, $event_id) { 'value' => $event_id, 'compare' => '=' ), - // array( - // 'key' => 'ea_flag', - // 'value' => 'checkout_processed', - // 'compare' => '=' - // ) array( - 'key' => 'ea_order_status', - 'value' => 'pending', + 'key' => 'ea_flag', + 'value' => 'checkout_processed', 'compare' => '=' ) ) @@ -774,11 +816,16 @@ function mep_delete_attandee_of_an_order($order_id, $event_id) { $loop = new WP_Query($args); foreach ($loop->posts as $ticket) { $post_id = $ticket->ID; - wp_delete_post($post_id, true); + $post_date = get_the_date('Y-m-d H:i:s',$post_id); + $time_diff = mep_diff_two_datetime($post_date,current_time('Y-m-d H:i:s')); + if($time_diff > 15){ + wp_delete_post($post_id, true); + } } } } + if (!function_exists('change_attandee_order_status')) { function change_attandee_order_status($order_id, $set_status, $post_status, $qr_status = null) { add_filter('wpseo_public_post_statuses', 'mepfix_sitemap_exclude_post_type', 5); @@ -2944,6 +2991,7 @@ if (!function_exists('mep_hide_date_from_order_page')) { function mep_hide_date_from_order_page() { $product_id = []; + $hide_wc = mep_get_option('mep_show_hidden_wc_product', 'general_setting_sec', 'no'); $args = array( 'post_type' => 'mep_events', 'posts_per_page' => -1 @@ -2955,8 +3003,10 @@ function mep_hide_date_from_order_page() { } $product_id = array_filter($product_id); $parr = implode(', ', $product_id); +if($hide_wc == 'no'){ echo ''; } +} } diff --git a/inc/template-prts/event_add_cart.php b/inc/template-prts/event_add_cart.php index 9251bf3..b9f718f 100755 --- a/inc/template-prts/event_add_cart.php +++ b/inc/template-prts/event_add_cart.php @@ -174,7 +174,7 @@ if (!function_exists('mep_get_event_reg_btn')) { - + diff --git a/inc/template-prts/google_map.php b/inc/template-prts/google_map.php index e09ae5e..a2a29bd 100755 --- a/inc/template-prts/google_map.php +++ b/inc/template-prts/google_map.php @@ -9,6 +9,7 @@ if (!function_exists('mep_event_google_map')) { { global $post, $event_meta, $user_api; $map_type = mep_get_option('mep_google_map_type', 'general_setting_sec', 'iframe'); + $map_zoom = mep_get_option('mep_google_map_zoom_level', 'general_setting_sec', '17'); $location_sts = get_post_meta($event_id, 'mep_org_address', true) ? get_post_meta($event_id, 'mep_org_address', true) : ''; $status = get_post_meta($event_id, 'mep_sgm', true) ? get_post_meta($event_id, 'mep_sgm', true) : ''; ob_start(); @@ -43,7 +44,7 @@ if (!function_exists('mep_event_google_map')) { lat: , lng: }, - zoom: 17 + zoom: }); marker = new google.maps.Marker({ map: map, diff --git a/woocommerce-event-press.php b/woocommerce-event-press.php index a8956d4..1104bd5 100644 --- a/woocommerce-event-press.php +++ b/woocommerce-event-press.php @@ -3,7 +3,7 @@ * Plugin Name: Event Manager and Tickets Selling Plugin for WooCommerce * Plugin URI: http://mage-people.com * Description: A Complete Event Solution for WordPress by MagePeople.. - * Version: 3.8.6 + * Version: 3.8.7 * Author: MagePeople Team * Author URI: http://www.mage-people.com/ * Text Domain: mage-eventpress