- optimized access class;

This commit is contained in:
Nikita Sinelnikov
2021-07-28 16:56:30 +03:00
parent fd503cc5ab
commit 4ae19c04fc
+4 -10
View File
@@ -877,6 +877,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
return $posts;
}
if ( current_user_can( 'administrator' ) ) {
return $posts;
}
$restricted_global_message = UM()->options()->get( 'restricted_access_message' );
$restricted_global_title = UM()->options()->get( 'restricted_access_post_title' );
@@ -918,11 +922,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
continue;
} else {
if ( current_user_can( 'administrator' ) ) {
$filtered_posts[] = $post;
continue;
}
if ( empty( $is_singular ) ) {
//if not single query when exclude if set _um_access_hide_from_queries
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
@@ -1007,11 +1006,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
//if post for logged in users and user is not logged in
if ( is_user_logged_in() ) {
if ( current_user_can( 'administrator' ) ) {
$filtered_posts[] = $post;
continue;
}
$custom_restrict = $this->um_custom_restriction( $restriction );
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {