diff --git a/includes/core/class-access.php b/includes/core/class-access.php index eb7dbfe6..58471e3c 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -1132,7 +1132,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { } else { $restriction_settings = $this->get_post_privacy_settings( $menu_item->object_id ); if ( empty( $restriction_settings['_um_access_hide_from_queries'] ) || ! UM()->options()->get( 'disable_restriction_pre_queries' ) ) { - $filtered_items[] = $menu_item; + $filtered_items[] = $this->maybe_replace_nav_menu_title( $menu_item ); continue; } } @@ -1270,6 +1270,36 @@ if ( ! class_exists( 'um\core\Access' ) ) { } + /** + * @param \WP_Post $nav_item + * + * @return \WP_Post + */ + function maybe_replace_nav_menu_title( $nav_item ) { + if ( ! UM()->options()->get( 'restricted_post_title_replace' ) ) { + return $nav_item; + } + + if ( current_user_can( 'administrator' ) ) { + return $nav_item; + } + + if ( ! is_a( $nav_item, '\WP_Post' ) ) { + return $nav_item; + } + + $ignore = apply_filters( 'um_ignore_restricted_title', false, $nav_item->ID ); + if ( $ignore ) { + return $nav_item; + } + + $restricted_global_title = UM()->options()->get( 'restricted_access_post_title' ); + $nav_item->title = stripslashes( $restricted_global_title ); + + return $nav_item; + } + + /** * Protect Post Types in query * Restrict content new logic diff --git a/readme.txt b/readme.txt index f429cb2a..4ef8c18c 100644 --- a/readme.txt +++ b/readme.txt @@ -155,9 +155,13 @@ The plugin works with popular caching plugins by automatically excluding Ultimat * To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0) * UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin -= 2.2.5: September 22, 2021 = += 2.2.5: September 21, 2021 = +* Bugfixes: + - Fixed: Invalid role keys on the role list-table + role edit screen (case when latin symbols used with not UTF-8 symbols) + - Fixed: Restriction logic and archive lists (+ nav menu bar) with active "Disable pre-queries for restriction content logic" option + - Fixed: Restriction settings fields conditions on wp-admin screens = 2.2.4: August 27, 2021 =