Skip to content

Commit d32be6f

Browse files
committed
Update the bbPress compat file.
1 parent 828756a commit d32be6f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

class.jetpack-bbpress-json-api-compat.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ private function __construct() {
2323
function allow_bbpress_post_types( $allowed_post_types ) {
2424

2525
// only run for REST API requests
26-
if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST || ! function_exists( 'bbpress' ) )
27-
return;
26+
if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST )
27+
return $allowed_post_types;
2828

2929
$allowed_post_types[] = 'forum';
3030
$allowed_post_types[] = 'topic';
@@ -35,8 +35,8 @@ function allow_bbpress_post_types( $allowed_post_types ) {
3535
function allow_bbpress_public_metadata( $allowed_meta_keys ) {
3636

3737
// only run for REST API requests
38-
if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST || ! function_exists( 'bbpress' ) )
39-
return;
38+
if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST )
39+
return $allowed_meta_keys;
4040

4141
$allowed_meta_keys[] = '_bbp_forum_id';
4242
$allowed_meta_keys[] = '_bbp_topic_id';
@@ -63,8 +63,8 @@ function allow_bbpress_public_metadata( $allowed_meta_keys ) {
6363
function adjust_meta_caps( $caps, $cap, $user_id, $args ) {
6464

6565
// only run for REST API requests
66-
if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST || ! function_exists( 'bbpress' ) )
67-
return;
66+
if ( ! defined( 'REST_API_REQUEST' ) || ! REST_API_REQUEST )
67+
return $caps;
6868

6969
// only modify caps for meta caps and for bbPress meta keys
7070
if ( ! in_array( $cap, array( 'edit_post_meta', 'delete_post_meta', 'add_post_meta' ) ) || empty( $args[1] ) || false === strpos( $args[1], '_bbp_' ) )
@@ -105,4 +105,4 @@ function adjust_meta_caps( $caps, $cap, $user_id, $args ) {
105105

106106
}
107107

108-
bbPress_Jetpack_REST_API::instance();
108+
bbPress_Jetpack_REST_API::instance();

0 commit comments

Comments
 (0)