File: /mnt/data/doccure-wp/wp-content/themes/doccure/directory/dashboard.php
<?php
/**
* Template Name: Dashboard
*
* @package doccure
* @since doccure 1.0
* @desc Template used for front end dashboard.
*/
/* Define Global Variables */
global $current_user, $wp_roles, $userdata, $post,$doccure_options;
$user_identity = $current_user->ID;
$url_identity = !empty($_GET['identity']) ? intval($_GET['identity']) : '';
$user_type = apply_filters('doccure_get_user_type', $user_identity );
$post_id = doccure_get_linked_profile_id( $user_identity );
$is_verified = get_post_meta($post_id, '_is_verified', true);
$ref = !empty($_GET['ref']) ? esc_html( $_GET['ref'] ) : '';
$mode = !empty($_GET['mode']) ? esc_html( $_GET['mode'] ) : '';
$verify_user = !empty( $doccure_options['verify_user'] ) ? $doccure_options['verify_user'] : '';
$doctor_location = !empty($doccure_options['doctor_location']) ? $doccure_options['doctor_location'] : '';
$doctros_pages = apply_filters( 'doccure_doctor_redirect_after_login','');
$doctor_booking_option = '';
if( function_exists( 'doccure_get_booking_oncall_doctors_option' ) ) {
$doctor_booking_option = doccure_get_booking_oncall_doctors_option();
}
if ( is_user_logged_in() ) {
} else {
wp_redirect(home_url());
exit;
}
if ( is_user_logged_in() && ( $user_type === 'doctors' ) ) {
get_header('doctor');
} else {
get_header();
}
if ( is_user_logged_in() && ( $user_type === 'doctors' ) ) {
get_template_part('directory/dashboard', 'doctor');
} else if ( is_user_logged_in() && ( $user_type === 'doctors_staff' ) ) {
get_template_part('directory/dashboard', 'doctor_staff');
}
else if ( is_user_logged_in() && ( $user_type === 'staff' ) ) {
get_template_part('directory/dashboard', 'staff');
}
else {
get_template_part('directory/dashboard', 'patient');
}
if ( is_user_logged_in() && ( $user_type === 'doctors' ) ) {
get_footer('doctor');
} else {
get_footer();
}