- 2.0.55 hotfix for profile restriction options;

This commit is contained in:
nikitasinelnikov
2019-08-16 20:23:45 +03:00
parent bd6237a3f6
commit 16e272edab
5 changed files with 22 additions and 6 deletions
+11
View File
@@ -550,6 +550,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
//exclude from privacy UM default pages (except Members list and User(Profile) page)
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
um_is_core_post( $post, 'password-reset' ) || ( is_user_logged_in() && um_is_core_post( $post, 'user' ) ) )
@@ -600,6 +601,16 @@ if ( ! class_exists( 'um\core\Access' ) ) {
return false;
} else {
//set default redirect if Profile page is restricted for not-logged in users
if ( ! is_user_logged_in() && um_is_core_post( $post, 'user' ) && $restriction['_um_accessible'] == '2' ) {
if ( isset( $restriction['_um_access_roles'] ) ) {
$restriction = array( '_um_accessible' => '2', '_um_access_roles' => $restriction['_um_access_roles'], '_um_noaccess_action' => '1', '_um_access_redirect' => '1', '_um_access_redirect_url' => get_home_url( get_current_blog_id() ) );
} else {
$restriction = array( '_um_accessible' => '2', '_um_noaccess_action' => '1', '_um_access_redirect' => '1', '_um_access_redirect_url' => get_home_url( get_current_blog_id() ) );
}
}
return $restriction;
}
}