ID; $calendars = get_terms('booked_custom_calendars',array('order_by' => 'slug','hide_empty' => false)); $calendar_ids = array(); if (!empty($calendars)): foreach($calendars as $calendar): $calendar_id = $calendar->term_id; $term_meta = get_option( "taxonomy_$calendar_id" ); if ($booked_current_user->user_email == $term_meta['notifications_user_id']): $calendar_ids[] = $calendar_id; endif; endforeach; endif; $historic = isset($atts['historic']) && $atts['historic'] ? true : false; $pending = isset($atts['pending']) && $atts['pending'] ? true : false; $time_format = get_option('time_format'); $date_format = get_option('date_format'); $appointments_array = booked_agent_appointments($my_id,false,$time_format,$date_format,$calendar_ids,$pending,$historic); $total_appts = count($appointments_array); $appointment_default_status = get_option('booked_new_appointment_default','draft'); if (!isset($atts['remove_wrapper'])): echo '
'.__('No pending appointments.','booked-frontend-agents').'
'; endif; elseif ($historic): if ($total_appts): echo ''.__('No past appointments.','booked-frontend-agents').'
'; endif; else: if ($total_appts): echo ''.__('No upcoming appointments.','booked-frontend-agents').'
'; endif; endif; foreach($appointments_array as $appt): $calendar_id = isset($appt['calendar_id'][0]->term_id) ? $appt['calendar_id'][0]->term_id : false; $today = date_i18n($date_format); $date_display = date_i18n($date_format,$appt['timestamp']); if ($date_display == $today){ $date_display = __('Today','booked-frontend-agents'); $day_name = ''; } else { $day_name = date_i18n('l',$appt['timestamp']).', '; } $date_to_convert = date('F j, Y',$appt['timestamp']); $cf_meta_value = get_post_meta($appt['post_id'], '_cf_meta_value',true); $timeslots = explode('-',$appt['timeslot']); $time_start = date($time_format,strtotime($timeslots[0])); $time_end = date($time_format,strtotime($timeslots[1])); $appt_date_time = strtotime($date_to_convert.' '.date('H:i:s',strtotime($timeslots[0]))); $current_timestamp = current_time('timestamp'); $google_date_startend = date('Ymd',$appt['timestamp']); $google_time_start = date('Hi',strtotime($timeslots[0])); $google_time_end = date('Hi',strtotime($timeslots[1])); $cancellation_buffer = get_option('booked_cancellation_buffer',0); if ($cancellation_buffer): if ($cancellation_buffer < 1){ $time_type = 'minutes'; $time_count = $cancellation_buffer * 60; } else { $time_type = 'hours'; $time_count = $cancellation_buffer; } $buffered_timestamp = strtotime('+'.$time_count.' '.$time_type,$current_timestamp); $date_to_compare = $buffered_timestamp; else: $date_to_compare = current_time('timestamp'); endif; if ($timeslots[0] == '0000' && $timeslots[1] == '2400'): $timeslotText = __('All day','booked-frontend-agents'); $google_date_startend_end = date('Ymd',strtotime(date('Y-m-d',$appt['timestamp']) . '+ 1 Day')); $google_time_end = '0000'; else : $timeslotText = (!get_option('booked_hide_end_times') ? __('from','booked-frontend-agents').' ' : __('at','booked-frontend-agents').' ') . $time_start . (!get_option('booked_hide_end_times') ? ' ' . __('to','booked-frontend-agents').' '.$time_end : ''); $google_date_startend_end = $google_date_startend; endif; $status = ($appt['status'] !== 'publish' && $appt['status'] !== 'future' ? __('pending','booked-frontend-agents') : __('approved','booked-frontend-agents')); $status_class = $appt['status'] !== 'publish' && $appt['status'] !== 'future' ? 'pending' : 'approved'; echo ''.__('Please log in to view your upcoming appointments.','booked-frontend-agents').'
'; endif; return ob_get_clean(); } } $booked_fea_shortcodes = new Booked_FEA_Shortcodes;