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

(BP_Media_Album) (Required) Media Album object.

Return

(bool)

Source

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

	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.