rcp_user_can_access( $user_id = 0, $post_id = 0 )
This function can be used to determine if a specific user has access to specific content. All restriction options are checked with this function, so this is the most accurate way to determine if a member has access to the content.
Parameters:
- $user_id - ID of the user to check.
- $post_id - ID of a post to check access for.
Return values:
true
if the given user can access the post.false
if the given user does not have access to view the post.
Example usage:
if( rcp_user_can_access( get_current_user_id(), get_the_ID() ) ) { // user can access } else { // user cannot access }