BP_REST_Media_Albums_Endpoint::bp_rest_check_album_privacy_restriction( BP_Media_Album $album )

Check user access based on the privacy for the single album.

Description

Parameters

$album

(Required) Media Album object.

Return

(bool)

Source

File: bp-media/classes/class-bp-rest-media-albums-endpoint.php

1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
protected function bp_rest_check_album_privacy_restriction( $album ) {
    return (
               'onlyme' === $album->privacy
               && bp_loggedin_user_id() !== $album->user_id
           )
           || (
               'loggedin' === $album->privacy
               && empty( bp_loggedin_user_id() )
           )
           || (
               bp_is_active( 'groups' )
               && 'grouponly' === $album->privacy
               && ! empty( $album->group_id )
               && 'public' !== bp_get_group_status( groups_get_group( $album->group_id ) )
               && empty( groups_is_user_admin( bp_loggedin_user_id(), $album->group_id ) )
               && empty( groups_is_user_mod( bp_loggedin_user_id(), $album->group_id ) )
               && empty( groups_is_user_member( bp_loggedin_user_id(), $album->group_id ) )
           )
           || (
               bp_is_active( 'friends' )
               && 'friends' === $album->privacy
               && ! empty( $album->user_id )
               && bp_loggedin_user_id() !== $album->user_id
               && 'is_friend' !== friends_check_friendship_status( $album->user_id, bp_loggedin_user_id() )
           );
}

Changelog

Changelog
Version Description
0.1.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.