This commit is contained in:
magepeopleteam 2021-02-25 11:55:25 +00:00
parent 4a1da15995
commit cdb2c63ade
12 changed files with 198 additions and 34 deletions

View File

@ -486,9 +486,3 @@ div#mp_event_all_info_in_tab .handle-actions.hide-if-no-js {
}
div.sell_expire_date {display: -webkit-flex;display: flex;}
div.sell_expire_date > * {-webkit-flex: 1;flex: 1;font-size: 10px !important;}

View File

@ -148,6 +148,24 @@ div.df-dtl p {color: #444;font-weight: 600;font-size: 14px;margin: 0 0 5px 0;}
div.mep-default-feature-content p{color: #3a3a3a;font-size: 16px;}
.mep-event-details p{font-size: 16px;margin: 0;font-weight: 400;line-height: 1.5;}
.mep-events-wrapper p#mep_btn_notice{text-align: center;font-size: 15px;color: red;margin: 0 0 7px 0;}
span.mep_warning {
text-align: center;
display: block;
border: 1px solid #005373;
color: #005373;
font-weight: bold;
font-size: 15px;
padding: 20px 0;
text-transform: capitalize;
}
.mep_sidebar {
padding: 10px;
}
.mep_sidebar h3 {
text-align: left;
border-bottom: 1px solid #ddd;
padding-bottom: 15px;
}
/******table*******/
.mep-events-wrapper table {width: 100%;table-layout: fixed;margin: 0 0 15px 0;}
.mep-events-wrapper table td {text-align:left;border-bottom: 1px solid #f0f0f0;padding: 10px;vertical-align: middle;font-size: 16px;font-weight: 500;}

View File

@ -955,12 +955,18 @@ class MP_Event_All_Info_In_One
{
$event_label = mep_get_option('mep_event_label', 'general_setting_sec', 'Events');
$event_type = get_post_meta($post_id, 'mep_event_type', true);
$event_member_type = get_post_meta($post_id, 'mep_member_only_event', true);
$saved_user_role = get_post_meta($post_id, 'mep_member_only_user_role', true) ? get_post_meta($post_id, 'mep_member_only_user_role', true) : [];
$description = get_post_meta($post_id, 'mp_event_virtual_type_des', true);
$checked = ($event_type == 'online') ? 'checked' : '';
$member_checked = ($event_member_type == 'member_only') ? 'checked' : '';
// print_r($saved_user_role);
?>
<tr>
<th><span><?php echo $event_label;
_e(' Is Virtual?', 'mage-eventpress'); ?></span></th>
_e('Is Virtual?', 'mage-eventpress'); ?></span></th>
<td colspan="3">
<label class="mp_event_virtual_type_des_switch">
<input class="mp_opacity_zero" type="checkbox" name="mep_event_type" <?php echo $checked; ?> />
@ -973,6 +979,22 @@ class MP_Event_All_Info_In_One
</label>
</td>
</tr>
<tr>
<th><span><?php _e('Member Only Event?', 'mage-eventpress'); ?></span></th>
<td colspan="3">
<label class="mp_event_virtual_type_des_switch">
<input class="mp_opacity_zero" type="checkbox" name="mep_member_only_event" <?php echo $member_checked; ?> />
<span class="slider round"></span>
</label>
<p></p>
<label class="mp_event_virtual_type_des <?php echo ($event_member_type == 'member_only') ? 'active' : ''; ?>">
<select name='mep_member_only_user_role[]' multiple>
<option value="all" <?php if ( in_array('all',$saved_user_role)) { echo 'Selected'; } ?>><?php _e('For Any Logged in user', 'mage-eventpress'); ?> </option>
<?php echo mep_get_user_list($saved_user_role); ?>
</select>
</label>
</td>
</tr>
<?php
}
@ -1304,6 +1326,7 @@ function mep_event_meta_save($post_id)
$mep_available_seat = isset($_POST['mep_available_seat']) ? strip_tags($_POST['mep_available_seat']) : 'off';
$_tax_status = isset($_POST['_tax_status']) ? strip_tags($_POST['_tax_status']) : 'none';
$_tax_class = isset($_POST['_tax_class']) ? strip_tags($_POST['_tax_class']) : '';
$mep_member_only_user_role = isset($_POST['mep_member_only_user_role']) ? maybe_unserialize( $_POST['mep_member_only_user_role']) : maybe_unserialize(array('all'));
$sku = isset($_POST['mep_event_sku']) ? strip_tags($_POST['mep_event_sku']) : $post_id;
$mep_rich_text_status = isset($_POST['mep_rich_text_status']) ? strip_tags($_POST['mep_rich_text_status']) : 'enable';
@ -1362,12 +1385,19 @@ function mep_event_meta_save($post_id)
update_post_meta($pid, '_price', 0);
update_post_meta($pid, '_virtual', 'yes');
update_post_meta($pid, '_sku', $sku);
update_post_meta($pid, 'mep_member_only_user_role', $mep_member_only_user_role);
if (isset($_POST['mep_event_type']) && strip_tags($_POST['mep_event_type'])) {
$mep_event_type = 'online';
} else {
$mep_event_type = 'offline';
}
if (isset($_POST['mep_member_only_event']) && strip_tags($_POST['mep_member_only_event'])) {
$mep_event_member_type = 'member_only';
} else {
$mep_event_member_type = 'for_all';
}
update_post_meta($pid, 'mep_member_only_event', $mep_event_member_type);
update_post_meta($pid, 'mep_event_type', $mep_event_type);
$mp_event_virtual_type_des = isset($_POST['mp_event_virtual_type_des']) ? strip_tags($_POST['mp_event_virtual_type_des']) : "";
update_post_meta($pid, 'mp_event_virtual_type_des', $mp_event_virtual_type_des);

View File

@ -154,7 +154,7 @@ function mep_display_custom_fields_text_cart($item_data, $cart_item)
}
if (is_array($event_extra_service) && sizeof($event_extra_service) > 0) {
foreach ($event_extra_service as $extra_service) {
echo '<li>' . $extra_service['service_name'] . " - " . wc_price(mep_get_price_including_tax($eid,$extra_service['service_price'])) . ' x ' . $extra_service['service_qty'] . ' = ' . wc_price( mep_get_price_including_tax($eid,(int) $extra_service['service_price'] * (int) $extra_service['service_qty'])) . '</li>';
echo '<li>' . $extra_service['service_name'] . " - " . wc_price(mep_get_price_including_tax($eid,$extra_service['service_price'])) . ' x ' . $extra_service['service_qty'] . ' = ' . wc_price( mep_get_price_including_tax($eid,(float) $extra_service['service_price'] * (float) $extra_service['service_qty'])) . '</li>';
}
}
do_action('mep_after_cart_item_display_list',$cart_item);

View File

@ -3592,3 +3592,79 @@ function mep_event_prevent_slug_conflict( $is_bad_slug, $slug, $post_type, $post
}
return $is_bad_slug;
}
function mep_get_user_list($name = []){
ob_start();
$editable_roles = get_editable_roles();
foreach ($editable_roles as $role => $details) {
$sub['role'] = esc_attr($role);
$sub['name'] = translate_user_role($details['name']);
$roles[] = $sub;
?>
<option value="<?php echo esc_attr($role); ?>" <?php if ( in_array(esc_attr($role),$name)) { echo 'Selected'; } ?>><?php echo translate_user_role($details['name']); ?></option>
<?php
}
return ob_get_clean();
}
function mep_get_event_add_cart_sec($post_id){
$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();
$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);
?>
<!-- Register Now Title -->
<h4 class="mep-cart-table-title">
<?php echo mep_get_option('mep_register_now_text', 'label_setting_sec') ? mep_get_option('mep_register_now_text', 'label_setting_sec') : _e('Register Now:', 'mage-eventpress'); ?>
</h4>
<!--The event add to cart main form start here-->
<form action="" method='post' id="mage_event_submit">
<?php
/**
* Here is a magic hook which fire just before of the Add to Cart Button, And the Ticket type & Extra service list are hooked up into this, You can find them into inc/template-parts/event_ticket_type_extra_service.php
*/
do_action('mep_event_ticket_type_extra_service', $post_id);
?>
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id, "_price", true); ?>" />
<!--The Add to cart button table start Here-->
<table class='table table-bordered mep_event_add_cart_table'>
<tr>
<td align="left" class='total-col'><?php echo mep_get_option('mep_quantity_text', 'label_setting_sec') ? mep_get_option('mep_quantity_text', 'label_setting_sec') : _e('Quantity:', 'mage-eventpress');
if ($mep_event_ticket_type) { ?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo $leftt; ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
<span id="ttyttl"></span>
<?php } ?>
<span class='the-total'> <?php echo mep_get_option('mep_total_text', 'label_setting_sec') ? mep_get_option('mep_total_text', 'label_setting_sec') : _e('Total', 'mage-eventpress'); ?>
<span id="usertotal"></span>
</span>
</td>
<td align="right">
<input type="hidden" name="mep_event_location_cart" value="<?php trim(mep_ev_location_ticket($post_id, $event_meta)); ?>">
<input type="hidden" name="mep_event_date_cart" value="<?php do_action('mep_event_date'); ?>">
<button type="submit" name="add-to-cart" value="<?php echo $cart_product_id; ?>" class="single_add_to_cart_button button alt btn-mep-event-cart"><?php _e(mep_get_label($post_id, 'mep_cart_btn_text', 'Register This Event'), 'mage-eventpress'); ?> </button>
</td>
</tr>
</table>
<!--The Add to cart button table start Here-->
</form>
<!--The event add to cart main form end here-->
<?php
}
function mep_default_sidebar_reg() {
register_sidebar( array(
'name' => __( 'Woocommerce Event Manager Sidebar', 'mage-eventpress' ),
'id' => 'mep_default_sidebar',
'description' => __( 'This is the Default sidebar of the Woocommerce Event manager template.', 'mage-eventpress' ),
'before_widget' => '<div id="%1$s" class="mep_sidebar mep_widget_sec widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'mep_default_sidebar_reg' );

View File

@ -12,31 +12,30 @@ function mep_event_query($show, $sort = '', $cat = '', $org = '', $city = '', $c
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old;
$now = current_time('Y-m-d H:i:s');
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$etype = $evnt_type == 'expired' ? '<' : '>';
$cat_id = explode(',',$cat);
$org_id = explode(',',$org);
$cat_filter = !empty($cat) ? array(
'taxonomy' => 'mep_cat',
'field' => 'term_id',
'terms' => $cat
'terms' => $cat_id
) : '';
$org_filter = !empty($org) ? array(
'taxonomy' => 'mep_org',
'field' => 'term_id',
'terms' => $org
'terms' => $org_id
) : '';
$city_filter = !empty($city) ? array(

View File

@ -350,6 +350,7 @@ function mep_event_add_to_cart_section($atts, $content = null)
ob_start();
if($event > 0){
echo mep_shortcode_add_cart_section_html($event);
do_action('mep_after_event_cart_shortcode',$event);
}
return ob_get_clean();
}

View File

@ -8,7 +8,14 @@ if (!function_exists('mep_get_event_reg_btn')) {
// Get Event Registration Button
function mep_get_event_reg_btn($event_id = '')
{
global $post, $event_meta;
$saved_user_role = get_post_meta($event_id, 'mep_member_only_user_role', true) ? get_post_meta($event_id, 'mep_member_only_user_role', true) : [];
$event_member_type = get_post_meta($event_id, 'mep_member_only_event', true) ? get_post_meta($event_id, 'mep_member_only_event', true) : 'for_all';
$total_book = 0;
$post_id = $event_id ? $event_id : get_the_id();
$event_meta = get_post_custom($post_id);
@ -97,6 +104,14 @@ if (!function_exists('mep_get_event_reg_btn')) {
/**
* If everything is fine then its go on ....
*/
if( $event_member_type == 'for_all' || ($event_member_type != 'for_all' && is_user_logged_in() && ( in_array(wp_get_current_user()->roles[0],$saved_user_role) || in_array('all',$saved_user_role) ) )){
//if( in_array($user_role,$saved_user_role) ){
?>
<!-- Register Now Title -->
<h4 class="mep-cart-table-title">
@ -134,7 +149,24 @@ if (!function_exists('mep_get_event_reg_btn')) {
<!--The Add to cart button table start Here-->
</form>
<!--The event add to cart main form end here-->
<?php
}else{
echo '<span class="mep_warning">';
_e("Whoops, this event for members only. Login to view content. Not a member? That's easy.","mage-eventpress");
echo '</span>';
}
?>
<?php
}
} // End Of checking Registration status
}

View File

@ -7,6 +7,9 @@ add_action('mep_event_ticket_type_loop_list', 'mep_event_ticket_type_loop_list_h
if (!function_exists('mep_event_ticket_type_loop_list_html')) {
function mep_event_ticket_type_loop_list_html($post_id)
{
$mep_available_seat = get_post_meta($post_id, 'mep_available_seat', true) ? get_post_meta($post_id, 'mep_available_seat', true) : 'on';
$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();
ob_start();

View File

@ -705,3 +705,12 @@ Some Bug fixed.
Event Server Status Check Page Added
03 Feb 2021*
= 3.4.5=
* Update Release:
Multi cat id support in Shortcode
Member Role wise event feature added
Early bird feature added in ticket type
Bug fixed
Hook added
25 Feb 2021*

View File

@ -122,7 +122,9 @@ $speaker_status = mep_get_option('mep_enable_speaker_list', 'general
<div class="mep-default-sidrbar-calender-btn">
<?php do_action('mep_event_add_calender',get_the_id()); ?>
</div>
<?php } ?>
<?php }
dynamic_sidebar('mep_default_sidebar');
?>
</div>
</div>
</div>

View File

@ -3,7 +3,7 @@
* Plugin Name: Woocommerce Events Manager
* Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 3.4.4
* Version: 3.4.5
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
* Text Domain: mage-eventpress