/*
Theme Name:        Efor
Text Domain:       efor
Version:           13.1.5
Description:       Coaching & Online Courses WordPress Theme
Requires at least: 6.2
Requires PHP:      7.0
Tags:              education
Author:            Pixelwars
Author URI:        https://themeforest.net/user/pixelwars
Theme URI:         https://themeforest.net/user/pixelwars/portfolio
License:           ThemeForest License
License URI:       https://themeforest.net/licenses
Domain Path:       /languages
*/


/*
    Do not remove any of the commented text above as it is used by the theme for proper function!
*/


/* Plugin: "Top 10 - Popular Posts" */

.tptn_counter {
	display: none;
}

/* Plugin: "Top 10 - Popular Posts" */


/* Plugin: "Tutor LMS" */

.tutor-course-archive-header {
	margin-top: 70px;
}

/* Plugin: "Tutor LMS" */


/* Plugin: "Social Feed Gallery" */

.instagram-gallery__actions {
	margin: 0px;
}

/* Plugin: "Social Feed Gallery" */


/* Plugin: "Contact Form 7" */

.wpcf7 .contact-form {
	margin-bottom: 0px;
}

.wpcf7 .wpcf7-form-control-wrap {
	display: block;
}

.wpcf7 span.wpcf7-not-valid-tip {
	position: absolute;
	left: 10px;
	bottom: -16px;
	font-size: 10px;
	color: #222222;
	background-color: #fbe7ba;
	padding: .2em .8em;
	margin: 0;
	min-width: 150px;
	z-index: 1;
}

.wpcf7 .wpcf7-spinner {
	display: block;
    margin-top: 15px;
    margin-left: auto;
    margin-right: auto;
}

.wpcf7 form .wpcf7-response-output {
	margin: 0px;
}
add_action('wp_loaded', function () {
    if (is_user_logged_in()) {
        $user_id = get_current_user_id();
        $user = get_userdata($user_id);

        // Check user role
        if (in_array('subscriber', $user->roles) || in_array('student', $user->roles)) {

            // Check approval status
            if (function_exists('wpau_get_user_status') && wpau_get_user_status($user_id) !== 'approved') {

                // Check if accessing dashboard (match by URL path)
                $request_uri = $_SERVER['REQUEST_URI'];
                if (strpos($request_uri, '/dashboard') !== false) {
                    wp_logout();
                    wp_redirect(site_url('/pending-approval'));
                    exit;
                }
            }
        }
    }
});

