Filter: um_can_view_user_profile

apply_filters( 'um_can_view_user_profile', $can_view_user, $user_id, $current_user ) → {null|bool}

Filters the marker for user capabilities to view other user profiles on the website

Parameters:
Name Type Description
$can_view_user null | bool

Can view user profile marker.

$user_id int

User ID requested to check capabilities for.

$current_user int

Current user.

Since:
  • 2.13.0
Source:
Returns:

Can view user profile marker. By default, it's null for using UM native logic.

Type
null | bool
Example

Set that only user with ID=5 can be viewed on Profile page.

function my_um_can_view_user_profile( $can_view_user, $user_id, $current_user ) {
    $can_view_user = 5 === $user_id;
    return $can_view_user;
}
add_filter( 'um_can_view_user_profile', 'my_um_can_view_user_profile', 10, 3 );