From 3f2589d3a8630b083904a164d9a27fcfa3c762aa Mon Sep 17 00:00:00 2001 From: magepeopleteam Date: Sun, 24 May 2020 08:17:41 +0000 Subject: [PATCH] version 3.2.6 released --- inc/mep_addon_list.php | 3 + inc/mep_enque.php | 3 + inc/mep_extra_price.php | 41 +- inc/mep_functions.php | 515 +++++++++-------- inc/mep_query.php | 4 + inc/mep_tax_fw_meta.php | 4 + inc/mep_tax_meta.php | 3 + inc/mep_user_custom_style.php | 3 + inc/template-prts/add_calender.php | 36 +- inc/template-prts/event_add_cart.php | 546 +++++++++--------- inc/template-prts/event_date.php | 460 ++++++++------- inc/template-prts/event_details.php | 51 +- inc/template-prts/event_extra_service.php | 136 ++--- inc/template-prts/event_labels.php | 36 +- .../event_list_tax_name_list.php | 97 ++-- inc/template-prts/event_location.php | 65 ++- inc/template-prts/event_loop_list.php | 249 ++++---- inc/template-prts/event_loop_minimal.php | 8 +- inc/template-prts/event_loop_native.php | 6 + inc/template-prts/event_loop_timeline.php | 9 +- inc/template-prts/event_loop_title.php | 6 + inc/template-prts/event_speakers_list.php | 7 +- inc/template-prts/event_ticket_type.php | 157 ++--- .../event_ticket_type_extra_service.php | 41 +- .../event_ticket_type_loop_list.php | 170 +++--- inc/template-prts/faq.php | 47 +- inc/template-prts/google_map.php | 140 +++-- inc/template-prts/organizer.php | 6 + inc/template-prts/price.php | 6 + .../shortcode_add_cart_section.php | 31 +- inc/template-prts/shortcode_speaker_list.php | 19 +- inc/template-prts/social_share.php | 29 +- inc/template-prts/templating.php | 4 + inc/template-prts/thumbnail.php | 33 +- inc/template-prts/title.php | 6 + inc/template-prts/total_seat.php | 56 +- readme.txt | 12 +- woocommerce-event-press.php | 38 +- 38 files changed, 1681 insertions(+), 1402 deletions(-) diff --git a/inc/mep_addon_list.php b/inc/mep_addon_list.php index 13cd71b..72c3899 100644 --- a/inc/mep_addon_list.php +++ b/inc/mep_addon_list.php @@ -1,4 +1,7 @@ '; +// print_r($ticket_type_arr); +// // print_r($qty); +// die(); /** * Now Store the datas into Cart Session */ @@ -160,30 +169,30 @@ function mep_checkout_validation($posted) foreach ($items as $item => $values) { $event_id = array_key_exists('event_id', $values) ? $values['event_id'] : 0; // $values['event_id']; if (get_post_type($event_id) == 'mep_events') { - $total_seat = mep_event_total_seat($event_id, 'total'); - $total_resv = mep_event_total_seat($event_id, 'resv'); + $recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no'; + $total_seat = apply_filters('mep_event_total_seat_counts', mep_event_total_seat($event_id, 'total'), $event_id); + $total_resv = apply_filters('mep_event_total_resv_seat_count', mep_event_total_seat($event_id, 'resv'), $event_id); $total_sold = mep_ticket_sold($event_id); $total_left = $total_seat - ($total_sold + $total_resv); - - $event_validate_info = $values['event_validate_info'] ? $values['event_validate_info'] : array(); - - $ee = 0; - - if (is_array($event_validate_info) && sizeof($event_validate_info) > 0) { - foreach ($event_validate_info as $inf) { - $ee = $ee + $inf['validation_ticket_qty']; + if($recurring == 'no'){ + $event_validate_info = $values['event_validate_info'] ? $values['event_validate_info'] : array(); + $ee = 0; + if (is_array($event_validate_info) && sizeof($event_validate_info) > 0) { + foreach ($event_validate_info as $inf) { + $ee = $ee + $inf['validation_ticket_qty']; + } } - } - - if ($ee > $total_left) { - $event = get_the_title($event_id); - wc_add_notice(__("Sorry, Seats are not available in $event, Available Seats $total_left but you selected $ee", 'mage-eventpress'), 'error'); - } + if ($ee > $total_left) { + $event = get_the_title($event_id); + wc_add_notice(__("Sorry, Seats are not available in $event, Available Seats $total_left but you selected $ee", 'mage-eventpress'), 'error'); + } + } } } } + /** * The Final function for cart handleing, If everything is fine after user hit the place order button then the below function will send the order data into the next hook for order processing and save to order meta data. */ diff --git a/inc/mep_functions.php b/inc/mep_functions.php index 0e5954d..f19a31b 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -3,20 +3,25 @@ if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly. // Language Load add_action( 'init', 'mep_language_load'); -function mep_language_load(){ - $plugin_dir = basename(dirname(__DIR__))."/languages/"; - load_plugin_textdomain( 'mage-eventpress', false, $plugin_dir ); -} - -function mep_get_builder_version(){ - if(is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' )){ - $data = get_plugin_data( ABSPATH . "wp-content/plugins/woocommerce-event-manager-addon-form-builder/addon-builder.php", false, false ); - return $data['Version']; - }else{ - return 0; +if (!function_exists('mep_language_load')) { + function mep_language_load(){ + $plugin_dir = basename(dirname(__DIR__))."/languages/"; + load_plugin_textdomain( 'mage-eventpress', false, $plugin_dir ); } } +if (!function_exists('mep_get_builder_version')) { + function mep_get_builder_version(){ + if(is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' )){ + $data = get_plugin_data( ABSPATH . "wp-content/plugins/woocommerce-event-manager-addon-form-builder/addon-builder.php", false, false ); + return $data['Version']; + }else{ + return 0; + } + } +} + +if (!function_exists('mep_check_builder_status')) { function mep_check_builder_status(){ $version = '3.2'; if(is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' )){ @@ -32,10 +37,10 @@ function mep_check_builder_status(){ return true; } } +} - - +if (!function_exists('mep_get_all_tax_list')) { function mep_get_all_tax_list($current_tax=null){ global $wpdb; $table_name = $wpdb->prefix . 'wc_tax_rate_classes'; @@ -47,12 +52,13 @@ function mep_get_all_tax_list($current_tax=null){

%s

', - __('You Must Install WooCommerce Plugin before activating WooCommerce Event Manager, Becuase It is dependent on Woocommerce Plugin') - ); - } add_action('woocommerce_before_checkout_form', 'mep_displays_cart_products_feature_image'); + if (!function_exists('mep_displays_cart_products_feature_image')) { function mep_displays_cart_products_feature_image() { foreach ( WC()->cart->get_cart() as $cart_item ) { $item = $cart_item['data']; } } + } // Send Confirmation email to customer + if (!function_exists('mep_event_confirmation_email_sent')) { function mep_event_confirmation_email_sent($event_id,$sent_email){ $values = get_post_custom($event_id); @@ -196,8 +181,11 @@ function mep_get_all_tax_list($current_tax=null){ $sent = wp_mail( $sent_email, $email_sub, nl2br($email_body), $headers ); } } + } + + if (!function_exists('mep_event_get_order_meta')) { function mep_event_get_order_meta($item_id,$key){ global $wpdb; $table_name = $wpdb->prefix."woocommerce_order_itemmeta"; @@ -209,9 +197,10 @@ function mep_get_all_tax_list($current_tax=null){ $val = isset($value) ? $value : ''; return $val; } +} - +if (!function_exists('mep_event_get_event_city_list')) { function mep_event_get_event_city_list(){ global $wpdb; $table_name = $wpdb->prefix."postmeta"; @@ -233,18 +222,22 @@ function mep_get_all_tax_list($current_tax=null){ post_name) return $page; return false; } +} //add_action('admin_init','mep_page_create'); // Cretae pages on plugin activation +if (!function_exists('mep_page_create')) { function mep_page_create() { if (! mep_get_page_by_slug('event-by-city-name')) { @@ -260,8 +253,9 @@ function mep_page_create() { } } +} - +if (!function_exists('mep_city_filter_rewrite_rule')) { function mep_city_filter_rewrite_rule() { add_rewrite_rule( '^event-by-city-name/(.+)/?$', @@ -269,28 +263,32 @@ function mep_city_filter_rewrite_rule() { 'top' ); } +} add_action( 'init', 'mep_city_filter_rewrite_rule' ); +if (!function_exists('mep_city_filter_query_var')) { function mep_city_filter_query_var( $vars ) { $vars[] = 'cityname'; return $vars; } +} add_filter( 'query_vars', 'mep_city_filter_query_var' ); - +if (!function_exists('mep_city_template_chooser')) { function mep_city_template_chooser($template){ if ( get_query_var( 'cityname' ) ) { $template = mep_template_file_path('page-city-filter.php'); } return $template; } +} add_filter('template_include', 'mep_city_template_chooser'); - - function mep_attendee_create($type,$order_id,$event_id,$_user_info = array()){ +if (!function_exists('mep_attendee_create')) { +function mep_attendee_create($type,$order_id,$event_id,$_user_info = array()){ // Getting an instance of the order object $order = wc_get_order( $order_id ); @@ -396,9 +394,10 @@ add_filter('template_include', 'mep_city_template_chooser'); } // End User Form builder data update loop } - +} +if (!function_exists('mep_attendee_extra_service_create')) { function mep_attendee_extra_service_create($order_id,$event_id, $_event_extra_service){ @@ -430,10 +429,12 @@ add_filter('template_include', 'mep_city_template_chooser'); } } +} - + add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10); + if (!function_exists('mep_event_booking_management')) { function mep_event_booking_management( $order_id) { @@ -514,10 +515,10 @@ add_filter('template_include', 'mep_city_template_chooser'); } +} - - +if (!function_exists('change_attandee_order_status')) { function change_attandee_order_status($order_id,$set_status,$post_status,$qr_status=null){ $args = array ( @@ -544,7 +545,10 @@ add_filter('template_include', 'mep_city_template_chooser'); wp_update_post($current_post); } } +} + +if (!function_exists('change_extra_service_status')) { function change_extra_service_status($order_id,$set_status,$post_status,$qr_status=null){ $args = array ( @@ -571,10 +575,10 @@ add_filter('template_include', 'mep_city_template_chooser'); wp_update_post($current_post); } } +} - - +if (!function_exists('change_wc_event_product_status')) { function change_wc_event_product_status($order_id,$set_status,$post_status,$qr_status=null){ $args = array ( @@ -601,12 +605,13 @@ add_filter('template_include', 'mep_city_template_chooser'); wp_update_post($current_post); } } - +} add_action('wp_trash_post','mep_addendee_trash',90); + if (!function_exists('mep_addendee_trash')) { function mep_addendee_trash( $post_id ) { $post_type = get_post_type( $post_id ); $post_status = get_post_status( $post_id ); @@ -620,13 +625,11 @@ add_filter('template_include', 'mep_city_template_chooser'); if ( $post_type == 'mep_events' ) { change_wc_event_product_status( $post_id, 'trash', 'publish', '' ); } - - - } - +} add_action('untrash_post','mep_addendee_untrash',90); + if (!function_exists('mep_addendee_untrash')) { function mep_addendee_untrash( $post_id ) { $post_type = get_post_type( $post_id ); $post_status = get_post_status( $post_id ); @@ -642,9 +645,11 @@ add_filter('template_include', 'mep_city_template_chooser'); } } +} add_action('woocommerce_order_status_changed', 'mep_attendee_status_update', 10, 4); + if (!function_exists('mep_attendee_status_update')) { function mep_attendee_status_update($order_id, $from_status, $to_status, $order ){ global $wpdb,$wotm; @@ -708,7 +713,7 @@ add_filter('template_include', 'mep_city_template_chooser'); } // End Function - +} @@ -716,6 +721,7 @@ add_filter('template_include', 'mep_city_template_chooser'); add_action('restrict_manage_posts', 'mep_filter_post_type_by_taxonomy'); + if (!function_exists('mep_filter_post_type_by_taxonomy')) { function mep_filter_post_type_by_taxonomy() { global $typenow; $post_type = 'mep_events'; // change to your post type @@ -734,11 +740,12 @@ add_filter('template_include', 'mep_city_template_chooser'); )); }; } - +} add_filter('parse_query', 'mep_convert_id_to_term_in_query'); + if (!function_exists('mep_convert_id_to_term_in_query')) { function mep_convert_id_to_term_in_query($query) { global $pagenow; $post_type = 'mep_events'; // change to your post type @@ -751,10 +758,11 @@ add_filter('template_include', 'mep_city_template_chooser'); } } - +} add_filter('parse_query', 'mep_attendee_filter_query'); + if (!function_exists('mep_attendee_filter_query')) { function mep_attendee_filter_query($query) { global $pagenow; $post_type = 'mep_events_attendees'; @@ -786,7 +794,7 @@ add_filter('template_include', 'mep_city_template_chooser'); } } - +} @@ -795,6 +803,7 @@ add_filter('template_include', 'mep_city_template_chooser'); // Add the data to the custom columns for the book post type: add_action( 'manage_mep_events_posts_custom_column' , 'mep_custom_event_column', 10, 2 ); + if (!function_exists('mep_custom_event_column')) { function mep_custom_event_column( $column, $post_id ) { switch ( $column ) { @@ -842,9 +851,10 @@ add_filter('template_include', 'mep_city_template_chooser'); break; } } - +} // Getting event exprie date & time + if (!function_exists('mep_get_event_status')) { function mep_get_event_status($startdatetime){ $current = current_time('Y-m-d H:i:s'); @@ -868,8 +878,9 @@ add_filter('template_include', 'mep_city_template_chooser'); return "$dd $hh $mm"; } } +} - +if (!function_exists('mep_merge_saved_array')) { function mep_merge_saved_array($arr1,$arr2){ $output = []; for ($i=0; $i prefix . 'woocommerce_order_itemmeta'; @@ -1063,10 +1088,11 @@ function mep_template_part_file_path($file_name){ echo mep_get_string_part($page->meta_key,$part).'
'; } } - } +} add_action('woocommerce_account_dashboard','mep_ticket_lits_users'); + if (!function_exists('mep_ticket_lits_users')) { function mep_ticket_lits_users(){ ob_start(); ?> @@ -1115,8 +1141,9 @@ function mep_template_part_file_path($file_name){ $content = ob_get_clean(); echo $content; } - - // mep_event_template_name(); +} + +if (!function_exists('mep_event_template_name')) { function mep_event_template_name(){ $template_name = 'index.php'; @@ -1148,9 +1175,10 @@ function mep_template_part_file_path($file_name){ } return $theme; } +} - +if (!function_exists('event_single_template_list')) { function event_single_template_list($current_theme){ $themes = mep_event_template_name(); $buffer = ''; echo $buffer; } - +} + + +if (!function_exists('mep_title_cutoff_words')) { function mep_title_cutoff_words($text, $length){ if(strlen($text) > $length) { $text = substr($text, 0, strpos($text, ' ', $length)); @@ -1169,7 +1200,10 @@ function mep_template_part_file_path($file_name){ return $text; } - +} + + +if (!function_exists('mep_get_tshirts_sizes')) { function mep_get_tshirts_sizes($event_id){ $event_meta = get_post_custom($event_id); $tee_sizes = $event_meta['mep_reg_tshirtsize_list'][0]; @@ -1180,82 +1214,14 @@ function mep_template_part_file_path($file_name){ } return $ts; } +} - - function my_function_meta_deta() { - global $order; - - $order_id = $_GET['post']; - // Getting an instance of the order object - $order = wc_get_order( $order_id ); - $order_meta = get_post_meta($order_id); - - # Iterating through each order items (WC_Order_Item_Product objects in WC 3+) - foreach ( $order->get_items() as $item_id => $item_values ) { - $product_id = $item_values->get_product_id(); - $item_data = $item_values->get_data(); - $product_id = $item_data['product_id']; - $item_quantity = $item_values->get_quantity(); - $product = get_page_by_title( $item_data['name'], OBJECT, 'mep_events' ); - $event_name = $item_data['name']; - $event_id = $product->ID; - $item_id = $item_id; - } - - $user_info_arr = wc_get_order_item_meta($item_id,'_event_user_info',true); - - // print_r($user_info_arr); - - ob_start(); - ?> -
- - - - - - - - -
NameCity
-
- id ); - - - - // add_action( 'woocommerce_thankyou', 'woocommerce_thankyou_change_order_status', 10, 1 ); - function woocommerce_thankyou_change_order_status( $order_id ){ - if( ! $order_id ) return; - - $order = wc_get_order( $order_id ); - - if( $order->get_status() == 'processing' ) - $order->update_status( 'completed' ); - } + +if (!function_exists('mep_event_list_price')) { function mep_event_list_price($pid){ global $post; $cur = get_woocommerce_currency_symbol(); @@ -1279,23 +1245,26 @@ function mep_template_part_file_path($file_name){ return $gn_price; } - +} + + +if (!function_exists('mep_get_label')) { function mep_get_label($pid,$label_id,$default_text){ return mep_get_option( $label_id, 'label_setting_sec', $default_text); } +} // Add the custom columns to the book post type: add_filter( 'manage_mep_events_posts_columns', 'mep_set_custom_edit_event_columns' ); + if (!function_exists('mep_set_custom_edit_event_columns')) { function mep_set_custom_edit_event_columns($columns) { - unset( $columns['date'] ); - - $columns['mep_status'] = __( 'Status', 'mage-eventpress' ); - + $columns['mep_status'] = __( 'Status', 'mage-eventpress' ); return $columns; } + } - + if (!function_exists('mep_get_full_time_and_date')) { function mep_get_full_time_and_date($datetime){ $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); @@ -1312,12 +1281,11 @@ function mep_template_part_file_path($file_name){ echo wp_date($wpdatesettings, strtotime($datetime)); } } +} - +if (!function_exists('mep_get_only_time')) { function mep_get_only_time($datetime){ $user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec','wtss'); - - //echo $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); if($user_set_format==12){ echo date('h:i A', strtotime($datetime)); @@ -1329,8 +1297,9 @@ function mep_template_part_file_path($file_name){ echo date($time_format, strtotime($datetime)); } } - +} +if (!function_exists('mep_get_event_city')) { function mep_get_event_city($id){ $location_sts = get_post_meta($id,'mep_org_address',true); $event_meta = get_post_custom($id); @@ -1338,17 +1307,15 @@ function mep_template_part_file_path($file_name){ $org_arr = get_the_terms( $id, 'mep_org' ); if(is_array($org_arr) && sizeof($org_arr) > 0 ){ $org_id = $org_arr[0]->term_id; - echo "".get_term_meta( $org_id, 'org_city', true ).""; + echo "".mep_ev_venue($id).', '.get_term_meta( $org_id, 'org_city', true ).""; } }else{ - - echo "".$event_meta['mep_city'][0].""; - + echo "".mep_ev_venue($id).', '.$event_meta['mep_city'][0].""; } } - +} - +if (!function_exists('mep_get_total_available_seat')) { function mep_get_total_available_seat($event_id, $event_meta){ $total_seat = mep_event_total_seat($event_id,'total'); $total_resv = mep_event_total_seat($event_id,'resv'); @@ -1356,14 +1323,16 @@ function mep_template_part_file_path($file_name){ $total_left = $total_seat - ($total_sold + $total_resv); return $total_left; } +} - - +if (!function_exists('mep_event_location_item')) { function mep_event_location_item($event_id,$item_name){ return get_post_meta($event_id,$item_name,true); } - +} + +if (!function_exists('mep_event_org_location_item')) { function mep_event_org_location_item($event_id,$item_name){ $location_sts = get_post_meta($event_id,'mep_org_address',true); @@ -1373,7 +1342,9 @@ function mep_template_part_file_path($file_name){ return get_term_meta( $org_id, $item_name, true ); } } +} +if (!function_exists('mep_get_all_date_time')) { function mep_get_all_date_time( $start_datetime, $more_datetime, $end_datetime ) { ob_start(); @@ -1426,32 +1397,11 @@ function mep_template_part_file_path($file_name){ $content = ob_get_clean(); echo $content; } +} + + - function get_single_date_time( $start_datetime, $end_datetime ) { - - $date_format = get_option( 'date_format' ); - $time_format = get_option( 'time_format' ); - $wpdatesettings = $date_format.$time_format; - - $start_date = date_i18n( $date_format, strtotime( $start_datetime ) ); - $end_date = date_i18n( $date_format, strtotime( $end_datetime ) ); - - $nameOfDay = date_i18n( $date_format, strtotime( $start_date ) ); - $nameOfDayEnd = date_i18n( $date_format, strtotime( $end_date ) ); - - $start_time = date_i18n($time_format, strtotime( $start_datetime ) ); - $end_time = date_i18n($time_format, strtotime( $end_datetime ) ); - - if ( $start_date == $end_date ) { - return $nameOfDay . " " . $start_time . " - " . $end_time; - } else { - return $nameOfDay . " " . $start_time . " " . $nameOfDayEnd . " " . $end_time; - } - - } - - - +if (!function_exists('mep_get_event_locaion_item')) { function mep_get_event_locaion_item($event_id,$item_name){ if($event_id){ $location_sts = get_post_meta($event_id,'mep_org_address',true); @@ -1549,12 +1499,11 @@ function mep_template_part_file_path($file_name){ return get_post_meta($event_id,'mep_country',true); } } - - - } - + } } +} +if (!function_exists('mep_save_attendee_info_into_cart')) { function mep_save_attendee_info_into_cart($product_id){ $user = array(); @@ -1702,9 +1651,10 @@ function mep_template_part_file_path($file_name){ } return $user; } +} - +if (!function_exists('mep_wc_price')) { function mep_wc_price( $price, $args = array() ) { $args = apply_filters( 'wc_price_args', wp_parse_args( @@ -1745,12 +1695,14 @@ function mep_template_part_file_path($file_name){ */ return apply_filters( 'mep_wc_price', $return, $price, $args, $unformatted_price ); } +} - +if (!function_exists('mep_get_event_total_seat')) { function mep_get_event_total_seat($event_id,$m=null,$t=null){ - $total_seat = mep_event_total_seat($event_id,'total'); - $total_resv = mep_event_total_seat($event_id,'resv'); + + $total_seat = apply_filters( 'mep_event_total_seat_counts', mep_event_total_seat($event_id,'total'), $event_id ); + $total_resv = apply_filters( 'mep_event_total_resv_seat_count', mep_event_total_seat($event_id,'resv'), $event_id ); $total_sold = mep_ticket_sold($event_id); $total_left = $total_seat - ($total_sold + $total_resv); if($t=='multi'){ @@ -1763,10 +1715,10 @@ function mep_template_part_file_path($file_name){ post_count; } +} - +if (!function_exists('mep_extra_service_sold')) { function mep_extra_service_sold($event_id,$type,$date){ //echo $date; $args = array( @@ -1981,8 +1936,9 @@ function mep_template_part_file_path($file_name){ return $count; } +} - +if (!function_exists('mep_ticket_sold')) { function mep_ticket_sold($event_id){ $event_start_date = date('Y-m-d',strtotime(get_post_meta($event_id,'event_start_date',true))); // $get_ticket_type_list = get_post_meta($event_id,'mep_event_ticket_type',true) ? get_post_meta($event_id,'mep_event_ticket_type',true) : array(); @@ -2014,9 +1970,10 @@ function mep_template_part_file_path($file_name){ return $sold; } +} - +if (!function_exists('mep_event_total_seat')) { function mep_event_total_seat($event_id,$type){ $mep_event_ticket_type = get_post_meta($event_id, 'mep_event_ticket_type', true); // print_r($mep_event_ticket_type); @@ -2033,13 +1990,13 @@ function mep_template_part_file_path($file_name){ } return $total; } +} - - +if (!function_exists('get_mep_datetime')) { function get_mep_datetime($date,$type){ $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); @@ -2072,7 +2029,9 @@ function get_mep_datetime($date,$type){ return wp_date( 'M', $timestamp ); } } +} +if (!function_exists('mep_get_event_upcomming_date')) { function mep_get_event_upcomming_date($event_id,$type){ $recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no'; @@ -2102,9 +2061,10 @@ function get_mep_datetime($date,$type){ return get_mep_datetime($adt[0],$type); } +} - +if (!function_exists('mep_on_post_publish')) { function mep_on_post_publish( $post_id, $post, $update ) { if ($post->post_type == 'mep_events' && $post->post_status == 'publish' && empty(get_post_meta( $post_id, 'check_if_run_once' ))) { @@ -2131,8 +2091,10 @@ function get_mep_datetime($date,$type){ update_post_meta( $post_id, 'check_if_run_once', true ); } } +} add_action( 'wp_insert_post', 'mep_on_post_publish', 10, 3 ); + if (!function_exists('mep_count_hidden_wc_product')) { function mep_count_hidden_wc_product($event_id){ $args = array( 'post_type' => 'product', @@ -2149,9 +2111,10 @@ function get_mep_datetime($date,$type){ print_r($loop->posts); return $loop->post_count; } - +} add_action('save_post','mep_wc_link_product_on_save',99,1); + if (!function_exists('mep_wc_link_product_on_save')) { function mep_wc_link_product_on_save($post_id){ if (get_post_type($post_id) == 'mep_events') { @@ -2208,20 +2171,16 @@ function get_mep_datetime($date,$type){ } } - + } add_action('parse_query', 'mep_product_tags_sorting_query'); + if (!function_exists('mep_product_tags_sorting_query')) { function mep_product_tags_sorting_query($query) { global $pagenow; - $taxonomy = 'product_visibility'; - $q_vars = &$query->query_vars; - if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == 'product') { - - $tax_query = array([ 'taxonomy' => 'product_visibility', 'field' => 'slug', @@ -2232,10 +2191,31 @@ function get_mep_datetime($date,$type){ } } +} +add_action('wp','mep_hide_hidden_product_from_single'); +if (!function_exists('mep_hide_hidden_product_from_single')) { +function mep_hide_hidden_product_from_single(){ + global $post,$wp_query; + if(is_product()){ + $post_id = $post->ID; + $visibility = get_the_terms( $post_id, 'product_visibility' ); + if($visibility[0]->name == 'exclude-from-catalog'){ + $check_event_hidden = get_post_meta($post_id,'link_mep_event',true) ? get_post_meta($post_id,'link_mep_event',true) : 0; + if($check_event_hidden > 0){ + $wp_query->set_404(); + status_header( 404 ); + get_template_part( 404 ); + exit(); + } + } + } +} +} + + - - +if (!function_exists('get_event_list_js')) { function get_event_list_js($id,$event_meta,$currency_pos){ ob_start(); ?> @@ -2355,21 +2335,25 @@ function get_mep_datetime($date,$type){ $v){ @@ -2379,6 +2363,7 @@ function mage_array_strip($string, $allowed_tags = NULL){ } return strip_tags($string, $allowed_tags); } +} /** * The Giant SEO Plugin Yoast PRO doing some weird thing and that is its auto create a 301 redirect url when delete a post its causing our event some issue Thats why i disable those part for our event post type with the below filter hoook which is provide by Yoast. @@ -2391,6 +2376,7 @@ add_filter('wpseo_enable_notification_term_slug_change','__return_false'); * The below function will add the event more date list into the event list shortcode, Bu default it will be hide with a Show Date button, after click on that button it will the full list. */ add_action('mep_event_list_loop_footer','mep_event_recurring_date_list_in_event_list_loop'); +if (!function_exists('mep_event_recurring_date_list_in_event_list_loop')) { function mep_event_recurring_date_list_in_event_list_loop($event_id){ $recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no'; $more_date = get_post_meta($event_id,'mep_event_more_date',true); @@ -2445,18 +2431,22 @@ function mep_event_recurring_date_list_in_event_list_loop($event_id){ post_content)) ); } +} /** * This the function which will create the Rich Text Schema For each event into the section. */ add_action('wp_head','mep_event_rich_text_data'); +if (!function_exists('mep_event_rich_text_data')) { function mep_event_rich_text_data(){ global $post; $event_id = $post->ID; @@ -2510,12 +2500,13 @@ function mep_event_rich_text_data(){ echo $content = ob_get_clean(); } } - +} /** * We added event id with every order for using in the attendee & seat inventory calculation, but this info was showing in the thank you page, so i decided to hide this, and here is the fucntion which will hide the event id from the thank you page. */ add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_meta_in_emails' ); +if (!function_exists('mep_hide_event_order_meta_in_emails')) { function mep_hide_event_order_meta_in_emails( $meta ) { if( ! is_admin() ) { $criteria = array( 'key' => 'event_id' ); @@ -2523,7 +2514,9 @@ function mep_hide_event_order_meta_in_emails( $meta ) { } return $meta; } +} add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_data_from_thankyou_and_email', 10, 1 ); +if (!function_exists('mep_hide_event_order_data_from_thankyou_and_email')) { function mep_hide_event_order_data_from_thankyou_and_email($formatted_meta){ $hide_location_status = mep_get_option('mep_hide_location_from_order_page', 'general_setting_sec', 'no'); $hide_date_status = mep_get_option('mep_hide_date_from_order_page', 'general_setting_sec', 'no'); @@ -2542,13 +2535,14 @@ function mep_hide_event_order_data_from_thankyou_and_email($formatted_meta){ } return $temp_metas; } - +} /** * This will create a new section Custom CSS into the Event Settings Page, I write this code here instead of the Admin Settings Class because of YOU! Yes who is reading this comment!! to get the clear idea how you can craete your own settings section and settings fields by using the filter hook from any where or your own plugin. Thanks For reading this comment. Cheers!! */ add_filter('mep_settings_sec_reg','mep_custom_css_settings_reg',90); +if (!function_exists('mep_custom_css_settings_reg')) { function mep_custom_css_settings_reg($default_sec){ $sections = array( array( @@ -2558,7 +2552,9 @@ function mep_custom_css_settings_reg($default_sec){ ); return array_merge($default_sec,$sections); } +} add_filter('mep_settings_sec_fields','mep_custom_css_sectings_fields',90); +if (!function_exists('mep_custom_css_sectings_fields')) { function mep_custom_css_sectings_fields($default_fields){ $settings_fields = array( 'mep_settings_custom_css' => array( @@ -2573,7 +2569,9 @@ function mep_custom_css_sectings_fields($default_fields){ ); return array_merge($default_fields,$settings_fields); } +} add_action('wp_head','mep_apply_custom_css',90); +if (!function_exists('mep_apply_custom_css')) { function mep_apply_custom_css(){ $custom_css = mep_get_option( 'mep_custom_css', 'mep_settings_custom_css', ''); ob_start(); @@ -2585,9 +2583,10 @@ function mep_apply_custom_css(){ @@ -2866,7 +2874,10 @@ function mep_single_page_script(){ -
- -
+
+ +
+diff($datetime2); - $mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array(); - $total_seat = mep_event_total_seat($post_id,'total'); - $total_resv = mep_event_total_seat($post_id,'resv'); - $total_sold = mep_ticket_sold($post_id); - $total_left = $total_seat - ($total_sold + $total_resv); - $reg_status = array_key_exists('mep_reg_status', $event_meta) ? $event_meta['mep_reg_status'][0] : ''; - $seat_left = apply_filters( 'mep_event_total_seat_count', $total_left, $post_id ); - $current = current_time('Y-m-d H:i:s'); - $time = strtotime($event_expire_date); - $newformat = date('Y-m-d H:i:s',$time); - $recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no'; - - if($recurring == 'yes'){ - $event_more_dates = get_post_meta($post_id,'mep_event_more_date',true) ? get_post_meta($post_id,'mep_event_more_date',true) : array(); - $md = end($event_more_dates); - $more_date = $md['event_more_start_date'].' '.$md['event_more_start_time']; - $newformat = empty($event_more_dates) ? $newformat : date('Y-m-d H:i:s',strtotime($more_date)); - } - - // $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC'; - // date_default_timezone_set($default_timezone_val); - - $datetime1 = new DateTime($newformat); - $datetime2 = new DateTime($current); - $interval = date_diff($datetime2, $datetime1); - $mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on'; - - $leftt = apply_filters( 'mep_event_total_seat_count', $total_left, $post_id ); - $days = $interval->d; - $hours = $interval->h; - $minutes = $interval->i; - $dd = $days > 0 ? $days." days " : ''; - $hh = $hours>0 ? $hours." hours " : ''; - $mm = $minutes>0 ? $minutes." minutes " : ''; - $qty_typec = $event_meta['qty_box_type'][0]; - $cart_product_id = get_post_meta($post_id,'link_wc_product',true) ? esc_attr(get_post_meta($post_id,'link_wc_product',true)) : esc_attr($post_id); - - -/** -* First Checking If the registration status enable or disable -*/ -if($reg_status!='off'){ - /** - * Then Checking If the event date already gone or not - */ - if(strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)){ - /** - * If The event expired then it fire below Hook, The event expire texts arein the inc/template-parts/event_labels.php file - */ - do_action('mep_event_expire_text'); - - /** - * If the event is not expired then Its checking the available seat status - */ - }elseif($seat_left<=0){ - /** - * If All the seats are booked then it fire the below hooks, The event no seat texts are in the inc/template-parts/event_labels.php file - */ - do_action('mep_event_no_seat_text'); - do_action('mep_after_no_seat_notice'); - }else{ - /** - * If everything is fine then its go on .... - */ -?> - -

- -

- -
- - "/> - - - - - - - -
- - - - - - - - - - -
- -
- diff($datetime2); + $mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array(); + $total_seat = apply_filters('mep_event_total_seat_counts', mep_event_total_seat($post_id, 'total'), $post_id); + $total_resv = apply_filters('mep_event_total_resv_seat_count', mep_event_total_seat($post_id, 'resv'), $post_id); + $total_sold = mep_ticket_sold($post_id); + $total_left = $total_seat - ($total_sold + $total_resv); + $reg_status = array_key_exists('mep_reg_status', $event_meta) ? $event_meta['mep_reg_status'][0] : ''; + $seat_left = apply_filters('mep_event_total_seat_count', $total_left, $post_id); + $current = current_time('Y-m-d H:i:s'); + $time = strtotime($event_expire_date); + $newformat = date('Y-m-d H:i:s', $time); + $recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no'; + + if ($recurring == 'yes') { + $event_more_dates = get_post_meta($post_id, 'mep_event_more_date', true) ? get_post_meta($post_id, 'mep_event_more_date', true) : array(); + $md = end($event_more_dates); + $more_date = $md['event_more_start_date'] . ' ' . $md['event_more_start_time']; + $newformat = empty($event_more_dates) ? $newformat : date('Y-m-d H:i:s', strtotime($more_date)); + } + + // $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC'; + // date_default_timezone_set($default_timezone_val); + + $datetime1 = new DateTime($newformat); + $datetime2 = new DateTime($current); + $interval = date_diff($datetime2, $datetime1); + $mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on'; + + $leftt = apply_filters('mep_event_total_seat_count', $total_left, $post_id); + $days = $interval->d; + $hours = $interval->h; + $minutes = $interval->i; + $dd = $days > 0 ? $days . " days " : ''; + $hh = $hours > 0 ? $hours . " hours " : ''; + $mm = $minutes > 0 ? $minutes . " minutes " : ''; + $qty_typec = $event_meta['qty_box_type'][0]; + $cart_product_id = get_post_meta($post_id, 'link_wc_product', true) ? esc_attr(get_post_meta($post_id, 'link_wc_product', true)) : esc_attr($post_id); - - - -add_action('mep_add_to_cart_list','mep_get_event_reg_btn_list'); - - -// Get Event Registration Button -function mep_get_event_reg_btn_list(){ - global $post,$event_meta; - $total_book = 0; - $post_id = $post->ID; - $event_meta = get_post_custom($post_id); - $event_expire_on_old = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime'); - $event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old; - $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]); - $mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]); - $mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]); - $mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]); - $mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]); - $mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]); - $mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]); - $mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]); - $mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]); - // $simple_rsv = array_key_exists('mep_rsv_seat', $event_meta) ? $event_meta['mep_rsv_seat'][0] : 0; - // $total_book = ($total_book + $simple_rsv); - // $seat_left = ((int)$event_meta['mep_total_seat'][0]- (int)$total_book); - $time = strtotime($event_expire_date); - $newformat = date('Y-m-d H:i:s',$time); - $datetime1 = new DateTime(); - $datetime2 = new DateTime($newformat); - $interval = $datetime1->diff($datetime2); - $mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array(); - $total_seat = mep_event_total_seat(get_the_id(),'total'); - $total_resv = mep_event_total_seat(get_the_id(),'resv'); - $total_sold = mep_ticket_sold(get_the_id()); - $total_left = $total_seat - ($total_sold + $total_resv); - $reg_status = array_key_exists('mep_reg_status', $event_meta) ? $event_meta['mep_reg_status'][0] : ''; - $seat_left = apply_filters( 'mep_event_total_seat_count', $total_left, get_the_id() ); - $current = current_time('Y-m-d H:i:s'); - $time = strtotime($event_expire_date); - $newformat = date('Y-m-d H:i:s',$time); - $recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no'; - - if($recurring == 'yes'){ - $event_more_dates = get_post_meta($post_id,'mep_event_more_date',true) ? get_post_meta($post_id,'mep_event_more_date',true) : array(); - $md = end($event_more_dates); - $more_date = $md['event_more_start_date'].' '.$md['event_more_start_time']; - $newformat = empty($event_more_dates) ? $newformat : date('Y-m-d H:i:s',strtotime($more_date)); - } - - // $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC'; - // date_default_timezone_set($default_timezone_val); - - $datetime1 = new DateTime($newformat); - $datetime2 = new DateTime($current); - $interval = date_diff($datetime2, $datetime1); - $mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on'; - - $leftt = apply_filters( 'mep_event_total_seat_count', $total_left, get_the_id() ); - $days = $interval->d; - $hours = $interval->h; - $minutes = $interval->i; - $dd = $days > 0 ? $days." days " : ''; - $hh = $hours>0 ? $hours." hours " : ''; - $mm = $minutes>0 ? $minutes." minutes " : ''; - $qty_typec = $event_meta['qty_box_type'][0]; - $cart_product_id = get_post_meta($post_id,'link_wc_product',true) ? esc_attr(get_post_meta($post_id,'link_wc_product',true)) : esc_attr($post_id); - - -/** -* First Checking If the registration status enable or disable -*/ -if($reg_status!='off'){ - /** - * Then Checking If the event date already gone or not - */ - if(strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)){ - /** - * If The event expired then it fire below Hook, The event expire texts arein the inc/template-parts/event_labels.php file - */ - do_action('mep_event_expire_text'); - - /** - * If the event is not expired then Its checking the available seat status - */ - }elseif($seat_left<=0){ /** - * If All the seats are booked then it fire the below hooks, The event no seat texts are in the inc/template-parts/event_labels.php file - */ - do_action('mep_event_no_seat_text'); - do_action('mep_after_no_seat_notice'); - }else{ - /** - * If everything is fine then its go on .... - */ -?> - -

- -

- -
- - "/> - - - - - - - -
- - - - - - - - - - -
- -
- - strtotime($newformat)) { + /** + * If The event expired then it fire below Hook, The event expire texts arein the inc/template-parts/event_labels.php file + */ + do_action('mep_event_expire_text'); + + /** + * If the event is not expired then Its checking the available seat status + */ + } elseif ($seat_left <= 0) { + /** + * If All the seats are booked then it fire the below hooks, The event no seat texts are in the inc/template-parts/event_labels.php file + */ + do_action('mep_event_no_seat_text'); + do_action('mep_after_no_seat_notice'); + } else { + /** + * If everything is fine then its go on .... + */ +?> + +

+ +

+ +
+ + " /> + + + + + + + +
+ + + + + + + + + + +
+ +
+ + ID; + $event_meta = get_post_custom($post_id); + $event_expire_on_old = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime'); + $event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old; + $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]); + $mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]); + $mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]); + $mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]); + $mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]); + $mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]); + $mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]); + $mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]); + $mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]); + // $simple_rsv = array_key_exists('mep_rsv_seat', $event_meta) ? $event_meta['mep_rsv_seat'][0] : 0; + // $total_book = ($total_book + $simple_rsv); + // $seat_left = ((int)$event_meta['mep_total_seat'][0]- (int)$total_book); + $time = strtotime($event_expire_date); + $newformat = date('Y-m-d H:i:s', $time); + $datetime1 = new DateTime(); + $datetime2 = new DateTime($newformat); + $interval = $datetime1->diff($datetime2); + $mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array(); + $total_seat = mep_event_total_seat(get_the_id(), 'total'); + $total_resv = mep_event_total_seat(get_the_id(), 'resv'); + $total_sold = mep_ticket_sold(get_the_id()); + $total_left = $total_seat - ($total_sold + $total_resv); + $reg_status = array_key_exists('mep_reg_status', $event_meta) ? $event_meta['mep_reg_status'][0] : ''; + $seat_left = apply_filters('mep_event_total_seat_count', $total_left, get_the_id()); + $current = current_time('Y-m-d H:i:s'); + $time = strtotime($event_expire_date); + $newformat = date('Y-m-d H:i:s', $time); + $recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no'; + + if ($recurring == 'yes') { + $event_more_dates = get_post_meta($post_id, 'mep_event_more_date', true) ? get_post_meta($post_id, 'mep_event_more_date', true) : array(); + $md = end($event_more_dates); + $more_date = $md['event_more_start_date'] . ' ' . $md['event_more_start_time']; + $newformat = empty($event_more_dates) ? $newformat : date('Y-m-d H:i:s', strtotime($more_date)); + } + + // $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC'; + // date_default_timezone_set($default_timezone_val); + + $datetime1 = new DateTime($newformat); + $datetime2 = new DateTime($current); + $interval = date_diff($datetime2, $datetime1); + $mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on'; + + $leftt = apply_filters('mep_event_total_seat_count', $total_left, get_the_id()); + $days = $interval->d; + $hours = $interval->h; + $minutes = $interval->i; + $dd = $days > 0 ? $days . " days " : ''; + $hh = $hours > 0 ? $hours . " hours " : ''; + $mm = $minutes > 0 ? $minutes . " minutes " : ''; + $qty_typec = $event_meta['qty_box_type'][0]; + $cart_product_id = get_post_meta($post_id, 'link_wc_product', true) ? esc_attr(get_post_meta($post_id, 'link_wc_product', true)) : esc_attr($post_id); + + + /** + * First Checking If the registration status enable or disable + */ + if ($reg_status != 'off') { + /** + * Then Checking If the event date already gone or not + */ + if (strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)) { + /** + * If The event expired then it fire below Hook, The event expire texts arein the inc/template-parts/event_labels.php file + */ + do_action('mep_event_expire_text'); + + /** + * If the event is not expired then Its checking the available seat status + */ + } elseif ($seat_left <= 0) { + /** + * If All the seats are booked then it fire the below hooks, The event no seat texts are in the inc/template-parts/event_labels.php file + */ + do_action('mep_event_no_seat_text'); + do_action('mep_after_no_seat_notice'); + } else { + /** + * If everything is fine then its go on .... + */ + ?> + +

+ +

+ +
+ + " /> + + + + + + + +
+ + + + + + + + + + +
+ +
+ + -

-

, - - -

-

- 0) { - ?> -

-

- - -

-

- -

-

- -

- 2){ echo '