BP_REST_Document_Endpoint::bp_rest_check_privacy_restriction( BP_Document $document )
Check user access based on the privacy for the single document.
Description
Parameters
- $document
-
(Required) Document object.
Return
(bool)
Source
File: bp-document/classes/class-bp-rest-document-endpoint.php
protected function bp_rest_check_privacy_restriction( $document ) { return ( 'onlyme' === $document->privacy && bp_loggedin_user_id() !== $document->user_id ) || ( 'loggedin' === $document->privacy && empty( bp_loggedin_user_id() ) ) || ( bp_is_active( 'groups' ) && 'grouponly' === $document->privacy && ! empty( $document->group_id ) && 'public' !== bp_get_group_status( groups_get_group( $document->group_id ) ) && empty( groups_is_user_admin( bp_loggedin_user_id(), $document->group_id ) ) && empty( groups_is_user_mod( bp_loggedin_user_id(), $document->group_id ) ) && empty( groups_is_user_member( bp_loggedin_user_id(), $document->group_id ) ) ) || ( bp_is_active( 'friends' ) && 'friends' === $document->privacy && ! empty( $document->user_id ) && bp_loggedin_user_id() !== $document->user_id && 'is_friend' !== friends_check_friendship_status( $document->user_id, bp_loggedin_user_id() ) ); }
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.