- fixed restriction logic cases;

- fixed conditions for the restriction logic options;
This commit is contained in:
Nikita Sinelnikov
2021-09-14 18:21:41 +03:00
parent 66f5c8e820
commit 641f2c5a74
5 changed files with 20 additions and 16 deletions
+2 -2
View File
@@ -431,7 +431,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
'0' => __( 'Show access restricted message', 'ultimate-member' ),
'1' => __( 'Redirect user', 'ultimate-member' ),
),
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? '' : array( '_um_access_hide_from_queries', '=', '0' ),
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? array( '_um_accessible', '!=', '0' ) : array( '_um_access_hide_from_queries', '=', '0' ),
),
array(
'id' => '_um_restrict_by_custom_message',
@@ -583,7 +583,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
'0' => __( 'Show access restricted message', 'ultimate-member' ),
'1' => __( 'Redirect user', 'ultimate-member' ),
),
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? '' : array( '_um_access_hide_from_queries', '=', '0' ),
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? array( '_um_accessible', '!=', '0' ) : array( '_um_access_hide_from_queries', '=', '0' ),
),
array(
'id' => '_um_restrict_by_custom_message',
@@ -96,7 +96,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'0' => __( 'Show access restricted message', 'ultimate-member' ),
'1' => __( 'Redirect user', 'ultimate-member' ),
),
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? '' : array( '_um_access_hide_from_queries', '=', '0' ),
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? array( '_um_accessible', '!=', '0' ) : array( '_um_access_hide_from_queries', '=', '0' ),
),
array(
'id' => '_um_restrict_by_custom_message',
@@ -91,6 +91,8 @@ if ( ! empty( $_POST['role'] ) ) {
}
if ( preg_match( "/^[\p{Latin}\d\-_ ]+$/i", $data['name'] ) ) {
// uses sanitize_title instead of sanitize_key for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
$id = sanitize_title( $data['name'] );
} else {
$auto_increment = UM()->options()->get( 'custom_roles_increment' );
+1 -1
View File
@@ -1379,7 +1379,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
}
}
} else {
if ( UM()->options()->get( 'disable_restriction_pre_queries' ) || empty( $restriction['_um_access_hide_from_queries'] ) ) {
if ( empty( $restriction['_um_access_hide_from_queries'] ) || ! UM()->options()->get( 'disable_restriction_pre_queries' ) ) {
$filtered_posts[] = $this->maybe_replace_title( $post );
continue;
}
+14 -12
View File
@@ -29,12 +29,13 @@ if ( ! class_exists( 'um\core\User_posts' ) ) {
*/
function add_posts() {
$args = array(
'post_type' => 'post',
'posts_per_page' => 10,
'offset' => 0,
'author' => um_get_requested_user(),
'post_status' => array( 'publish' ),
'um_main_query' => true,
'post_type' => 'post',
'posts_per_page' => 10,
'offset' => 0,
'author' => um_get_requested_user(),
'post_status' => array( 'publish' ),
'um_main_query' => true,
'suppress_filters' => false,
);
/**
@@ -108,12 +109,13 @@ if ( ! class_exists( 'um\core\User_posts' ) ) {
$page = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 0;
$args = array(
'post_type' => 'post',
'posts_per_page' => 10,
'offset' => ( $page - 1 ) * 10,
'author' => $author,
'post_status' => array( 'publish' ),
'um_main_query' => true,
'post_type' => 'post',
'posts_per_page' => 10,
'offset' => ( $page - 1 ) * 10,
'author' => $author,
'post_status' => array( 'publish' ),
'um_main_query' => true,
'suppress_filters' => false,
);
/**