Skip to content

Commit

Permalink
Fix VideoPress and Memberships privacy setting override (#34189)
Browse files Browse the repository at this point in the history
* Fix memberships getting precedence when it shouldn't.
  • Loading branch information
pgk authored Nov 17, 2023
1 parent b62f68f commit a07d561
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix interaction with memberships and VideoPress privacy.
9 changes: 6 additions & 3 deletions projects/packages/videopress/src/class-access-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ private function build_restriction_details( $guid, $embedded_post_id, $selected_
$restriction_details = $this->default_video_restriction_details( $default_auth );

if ( $this->jetpack_memberships_available() ) {
$memberships_can_view_post = \Jetpack_Memberships::user_can_view_post( $embedded_post_id );
$restriction_details = $this->get_subscriber_only_restriction_details( $default_auth );
$restriction_details['can_access'] = $memberships_can_view_post;
$post_access_level = \Jetpack_Memberships::get_post_access_level( $embedded_post_id );
if ( 'everybody' !== $post_access_level ) {
$memberships_can_view_post = \Jetpack_Memberships::user_can_view_post( $embedded_post_id );
$restriction_details = $this->get_subscriber_only_restriction_details( $default_auth );
$restriction_details['can_access'] = $memberships_can_view_post;
}
}

return $this->check_block_level_access(
Expand Down

0 comments on commit a07d561

Please sign in to comment.