Ростислав ответил(а) на тему Как просмотреть профиль неактивированного юзера и запросить у него доп.инфу? в форуме
How to (Как сделать) ? 6 лет, 4 месяца назад
Оххохо!
Итак, я провёл небольшое исследование (помучал сайт echo’м, я просто не знаю других способов дебага PHP)
и уже нашёл место, где происходит всё колдовство, вот оно:/**
* Get the visibility levels that should be hidden for this user pair.
*
* Field visibility is determined based on the relationship between the
* logged-in user, the displayed user, and the visibility setting for the
* current field. (See bp_xprofile_get_hidden_fields_for_user().) This
* utility function speeds up this matching by fetching the visibility levels
* that should be hidden for the current user pair.
*
* @since 1.8.2
*
* @see bp_xprofile_get_hidden_fields_for_user()
*
* @param int $displayed_user_id The id of the user the profile fields belong to.
* @param int $current_user_id The id of the user viewing the profile.
* @return array An array of visibility levels hidden to the current user.
*/
function bp_xprofile_get_hidden_field_types_for_user( $displayed_user_id = 0, $current_user_id = 0 ) {// Current user is logged in.
if ( ! empty( $current_user_id ) ) {// Nothing's private when viewing your own profile, or when the
// current user is an admin.
if ( $displayed_user_id == $current_user_id || bp_current_user_can( 'bp_moderate' ) ) {
$hidden_levels = array();// If the current user and displayed user are friends, show all.
} elseif ( bp_is_active( 'friends' ) && friends_check_friendship( $displayed_user_id, $current_user_id ) ) {
$hidden_levels = array( 'adminsonly', );// Current user is logged in but not friends, so exclude friends-only.
} else {
$hidden_levels = array( 'friends', 'adminsonly', );
}// Current user is not logged in, so exclude friends-only, loggedin, and adminsonly.
} else {
$hidden_levels = array( 'friends', 'loggedin', 'adminsonly', );
}/**
* Filters the visibility levels that should be hidden for this user pair.
*
* @since 2.0.0
*
* @param array $hidden_fields Array of hidden fields for the displayed/logged in user.
* @param int $displayed_user_id ID of the displayed user.
* @param int $current_user_id ID of the current user.
*/
return apply_filters( 'bp_xprofile_get_hidden_field_types_for_user', $hidden_levels, $displayed_user_id, $current_user_id );
}
Последние комментарии