bp_media_query_privacy( int $user_id, int $group_id, string $scope = '' )
Get list of privacy based on user and group.
Description
Parameters
- $user_id
-
(Required) User ID.
- $group_id
-
(Required) Group ID.
- $scope
-
(Optional) Scope query parameter.
Default value: ''
Return
(mixed|void)
Source
File: bp-media/bp-media-functions.php
function bp_media_query_privacy( $user_id = 0, $group_id = 0, $scope = '' ) { $privacy = array( 'public' ); if ( is_user_logged_in() ) { // User filtering. $user_id = (int) ( empty( $user_id ) ? ( bp_displayed_user_id() ? bp_displayed_user_id() : false ) : $user_id ); $privacy[] = 'loggedin'; if ( bp_is_my_profile() || $user_id === bp_loggedin_user_id() ) { $privacy[] = 'onlyme'; if ( bp_is_active( 'friends' ) ) { $privacy[] = 'friends'; } } if ( ! in_array( 'friends', $privacy ) && bp_is_active( 'friends' ) ) { // get the login user id. $current_user_id = bp_loggedin_user_id(); // check if the login user is friends of the display user $is_friend = friends_check_friendship( $current_user_id, $user_id ); /** * check if the login user is friends of the display user * OR check if the login user and the display user is the same */ if ( $is_friend ) { $privacy[] = 'friends'; } } } if ( bp_is_group() || ( bp_is_active( 'groups' ) && ! empty( $group_id ) ) || ( !empty( $scope ) && 'groups' === $scope ) ) { $privacy = array( 'grouponly' ); } return apply_filters( 'bp_media_query_privacy', $privacy, $user_id, $group_id, $scope ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.