apply_filters( 'um_can_view_user', $can_view, $user_id, $current_user ) → {null|bool}
Filters the marker for user capabilities to view other users on the website
Parameters:
| Name | Type | Description |
|---|---|---|
$can_view |
null | bool | Can view user 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 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( $can_view_user, $user_id, $current_user ) {
$can_view_user = 5 === $user_id;
return $can_view_user;
}
add_filter( 'um_can_view_user', 'my_um_can_view_user', 10, 3 );