Hi @zholub,
I have a setup like your (a separate woocommerce for selling) ad so I had the same need.
I’ve solved with CSS, the data are still present on the page but hidden from view:
#learn-press-profile-nav .learn-press-tabs .orders,
#learn-press-profile-nav .learn-press-tabs .settings,
#learn-press-profile-nav .learn-press-tabs .dashboard
{
display: none!important;
visibility: hidden!important;
}
Then for making sure that user cannot access the related web pages, I’ve created some redirect rules
function redirect_courses() {
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
wp_redirect("/profile/" . $current_user->user_login . "/courses/purchased/" );
exit;
}
else {
wp_redirect("/wp-login.php?redirect_to=%2Fcourses%2F");
exit;
}
}
function redirect_courses_init(){
if ($_SERVER['REQUEST_URI'] == "/courses/") redirect_courses();
if (preg_match('"\\/courses\\/\\?"', $_SERVER['REQUEST_URI'])) redirect_courses();
if (preg_match('"\\/profile\\/settings\\/.*"', $_SERVER['REQUEST_URI'])) redirect_courses();
if (preg_match('"\\/profile\\/certificates\\/.*"', $_SERVER['REQUEST_URI'])) redirect_courses();
if (!is_user_logged_in() && preg_match('"\\/profile\\/.*"', $_SERVER['REQUEST_URI'])) redirect_courses();
if (!is_user_logged_in() && preg_match('"\\/courses\\/.*"', $_SERVER['REQUEST_URI'])) redirect_courses();
}
add_action('init', 'redirect_courses_init');
This is an example. Maybe you need to change something following you requirements but it could be a good entry point. I.e. In my production site I’ve keeped visible the password change page, because can be useful for users.
Ciao
Fabio
-
This reply was modified 6 years, 7 months ago by fabio.grasso.