data->user_pass, $user->ID)) { $creds = array('user_login' => $user->data->user_login, 'user_password' => $password); $creds['remember'] = true; } $user = wp_signon( $creds, false ); $page_id = get_queried_object_id(); wp_redirect(get_the_permalink($page_id)); exit; } } public function booked_profile_template(){ if (!is_user_logged_in()) { return do_shortcode('[booked-login]'); } else { ob_start(); require(BOOKED_PLUGIN_TEMPLATES_DIR . 'profile.php'); return ob_get_clean(); } } /* CALENDAR SWITCHER SHORTCODE */ public function booked_calendar_switcher_shortcode( $attrs ){ if( $attrs ){ extract( $attrs ); } $rand = rand(0000000,9999999); $args = array( 'taxonomy' => 'booked_custom_calendars', 'hide_empty' => 0, 'echo' => 0, 'class' => 'booked_calendar_chooser', 'id' => 'booked_calendar_chooser_'.$rand, 'name' => 'booked_calendar_chooser_'.$rand ); if( isset($id) ){ $args['include'] = wp_parse_id_list( $id ); $args['orderby'] = 'include'; } if (!get_option('booked_hide_default_calendar')): $args['show_option_all'] = esc_html__('Default Calendar','booked'); endif; return str_replace( "\n", '', wp_dropdown_categories( $args ) ); } /* CALENDAR SHORTCODE */ public function booked_calendar_shortcode($atts, $content = null){ $local_time = current_time('timestamp'); $calendars = get_terms('booked_custom_calendars',array('orderby'=>'name','order'=>'ASC','hide_empty'=>false)); $atts = shortcode_atts( array( 'size' => 'large', 'calendar' => false, 'year' => false, 'month' => false, 'day' => false, 'switcher' => false, 'style' => 'calendar', 'members-only' => false ), $atts ); if ($atts['members-only'] && is_user_logged_in() || !$atts['members-only']): ob_start(); $atts = apply_filters('booked_calendar_shortcode_atts', $atts ); $rand = rand(0000000,9999999); echo '
' . str_replace( "\n", '', wp_dropdown_categories( $args ) ) . '
'.esc_html__('No past appointments.','booked').'
'; endif; else: if ($total_appts): echo ''.esc_html__('No upcoming appointments.','booked').'
'; endif; endif; foreach($appointments_array as $appt): $today = date_i18n($date_format); $date_display = date_i18n($date_format,$appt['timestamp']); if ($date_display == $today){ $date_display = esc_html__('Today','booked'); $day_name = ''; } else { $day_name = date_i18n('l',$appt['timestamp']).', '; } $date_to_convert = date_i18n('Y-m-d',$appt['timestamp']); $cf_meta_value = get_post_meta($appt['post_id'], '_cf_meta_value',true); $timeslots = explode('-',$appt['timeslot']); $time_start = date_i18n($time_format,strtotime($timeslots[0])); $time_end = date_i18n($time_format,strtotime($timeslots[1])); $appt_date_time = strtotime($date_to_convert.' '.date_i18n('H:i:s',strtotime($timeslots[0]))); $atc_date_startend = date_i18n('Y-m-d',$appt['timestamp']); $atc_time_start = date_i18n('H:i:s',strtotime($timeslots[0])); $atc_time_end = date_i18n('H:i:s',strtotime($timeslots[1])); $current_timestamp = current_time('timestamp'); $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; $timeslotText = ''; $status = ($appt['status'] != 'publish' && $appt['status'] != 'future' ? esc_html__('pending','booked') : esc_html__('approved','booked')); $status_class = $appt['status'] != 'publish' && $appt['status'] != 'future' ? 'pending' : 'approved'; $ts_title = get_post_meta($appt['post_id'], '_appointment_title',true); if ($timeslots[0] == '0000' && $timeslots[1] == '2400'): if ($only_titles && !$ts_title || !$only_titles): $timeslotText = esc_html__('All day','booked'); endif; $atc_date_startend_end = date_i18n('Y-m-d',strtotime(date_i18n('Y-m-d',$appt['timestamp']) . '+ 1 Day')); $atc_time_end = '00:00:00'; else : if ($only_titles && !$ts_title || !$only_titles): $timeslotText = (!get_option('booked_hide_end_times') ? esc_html__('from','booked').' ' : esc_html__('at','booked').' ') . $time_start . (!get_option('booked_hide_end_times') ? ' – '.$time_end : ''); endif; $atc_date_startend_end = $atc_date_startend; endif; echo ''; if (!$historic): if ($appointment_default_status !== 'publish' && $appt['status'] !== 'future' || $appointment_default_status == 'publish' && $status_class == 'pending'): echo ''.($status_class == 'pending' ? '' : '').' '.$status.''; endif; endif; echo (!empty($appt['calendar_id']) ? ''.esc_html__('Calendar','booked').': '.$appt['calendar_id'][0]->name.''.esc_html__('Please log in to view your upcoming appointments.','booked').'
'; endif; return ob_get_clean(); } /* LOGIN SHORTCODE */ public function booked_login_form( $atts, $content = null ) { global $post; if (!is_user_logged_in()) { ob_start(); ?>