From 7a78dcde943b80853fda60fc733dc5f7616e775e Mon Sep 17 00:00:00 2001 From: yuriinalivaiko Date: Mon, 15 Mar 2021 16:09:31 +0200 Subject: [PATCH] Fix: field privacy option "Only visible to profile owner and specific roles" --- includes/um-short-functions.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 67c4c4f3..09d5d6df 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -1551,19 +1551,13 @@ function um_can_view_field( $data ) { } } break; - case '-3': + case '-3': // Only visible to profile owner and specific roles if ( ! is_user_logged_in() ) { $can_view = false; - } else { - if ( ! um_is_core_page( 'profile' ) ) { - if ( empty( $current_user_roles ) || ( ! empty( $data['roles'] ) && count( array_intersect( $current_user_roles, $data['roles'] ) ) <= 0 ) ) { - $can_view = false; - } - } else { - if ( ! um_is_user_himself() && ( empty( $current_user_roles ) || ( ! empty( $data['roles'] ) && count( array_intersect( $current_user_roles, $data['roles'] ) ) <= 0 ) ) ) { - $can_view = false; - } - } + } elseif ( um_is_core_page( 'user' ) && um_is_user_himself() ) { + $can_view = true; + } elseif ( empty( $current_user_roles ) || ( ! empty( $data['roles'] ) && count( array_intersect( $current_user_roles, $data['roles'] ) ) <= 0 ) ) { + $can_view = false; } break; default: