Skip to content

Commit 64d1304

Browse files
committed
Add public posts to logged-in user requests
1 parent f4aa3e5 commit 64d1304

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

plugins/bcc-login/includes/class-bcc-login-visibility.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ function on_rest_pre_echo_response( $response, $object, $request ) {
222222
}
223223

224224
if ( $session_is_valid ) {
225+
// Simply add the post if the post visibility is default or public
226+
if ( $visibility == self::VISIBILITY_DEFAULT || $visibility == self::VISIBILITY_PUBLIC ) {
227+
$response_arr[] = $item;
228+
continue;
229+
}
230+
225231
// Check login visibility
226232
if ( $visibility && $visibility > $user_level ) {
227233
continue;
@@ -245,6 +251,7 @@ function on_rest_pre_echo_response( $response, $object, $request ) {
245251
$response_arr[] = $item;
246252
}
247253
else if ( $visibility <= self::VISIBILITY_PUBLIC ) {
254+
// If the post visibility is public-only, default or public
248255
$response_arr[] = $item;
249256
}
250257
}

0 commit comments

Comments
 (0)