- fixed nav menu item title if it's restricted;

This commit is contained in:
Nikita Sinelnikov
2021-09-16 12:10:11 +03:00
parent ab83b99779
commit b3cf26d276
2 changed files with 36 additions and 2 deletions
+31 -1
View File
@@ -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
+5 -1
View File
@@ -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 =