Filter: um_can_view_private_user_profile

apply_filters( 'um_can_view_private_user_profile', $can_view_private_user_profile, $user_id, $current_user ) → {bool}

Filters whether a current user can view the private profile of another user. Controls the visibility of a private user profile.

Parameters:
Name Type Description
$can_view_private_user_profile bool

Default value is false. If true, it means the current user can view the other user's private profile.

$user_id int

ID of the user whose private profile is being accessed.

$current_user int

ID of the current user accessing the private profile.

Since:
  • 2.13.0
Source:
Returns:

Whether the current user can view the private profile of the specified user.

Type
bool
Example

User with ID=5 can see the private profiles.

function my_um_can_view_private_user_profile( $can_view_private_user_profile, $user_id, $current_user ) {
    $can_view_private_user_profile = 5 === $current_user;
    return $can_view_private_user_profile;
}
add_filter( 'um_can_view_private_user_profile', 'my_um_can_view_private_user_profile', 10, 3 );