BP_REST_Media_Endpoint::bp_rest_check_privacy_restriction( BP_Media $media )

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

Description

Parameters

$media

(Required) Media object.

Return

(bool)

Source

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

	protected function bp_rest_check_privacy_restriction( $media ) {
		$bool = ( 'onlyme' === $media->privacy && bp_loggedin_user_id() !== $media->user_id ) ||
			(
				'loggedin' === $media->privacy
				&& empty( bp_loggedin_user_id() )
			) ||
			(
				bp_is_active( 'groups' )
				&& 'grouponly' === $media->privacy
				&& ! empty( $media->group_id )
				&& 'public' !== bp_get_group_status( groups_get_group( $media->group_id ) )
				&& empty( groups_is_user_admin( bp_loggedin_user_id(), $media->group_id ) )
				&& empty( groups_is_user_mod( bp_loggedin_user_id(), $media->group_id ) )
				&& empty( groups_is_user_member( bp_loggedin_user_id(), $media->group_id ) )
			) ||
			(
				bp_is_active( 'friends' )
				&& 'friends' === $media->privacy
				&& ! empty( $media->user_id )
				&& bp_loggedin_user_id() !== $media->user_id
				&& 'is_friend' !== friends_check_friendship_status( $media->user_id, bp_loggedin_user_id() )
			);

		return $bool;
	}

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.