@@ 1076-1095 (lines=20) @@ | ||
1073 | } |
|
1074 | } |
|
1075 | ||
1076 | if ( |
|
1077 | -1 == get_option( 'blog_public' ) && |
|
1078 | /** |
|
1079 | * Filter access to a specific post. |
|
1080 | * |
|
1081 | * @module json-api |
|
1082 | * |
|
1083 | * @since 3.4.0 |
|
1084 | * |
|
1085 | * @param bool current_user_can( 'read_post', $post->ID ) Can the current user access the post. |
|
1086 | * @param WP_Post $post Post data. |
|
1087 | */ |
|
1088 | ! apply_filters( |
|
1089 | 'wpcom_json_api_user_can_view_post', |
|
1090 | current_user_can( 'read_post', $post->ID ), |
|
1091 | $post |
|
1092 | ) |
|
1093 | ) { |
|
1094 | return new WP_Error( 'unauthorized', 'User cannot view post', array( 'status_code' => 403, 'error' => 'private_blog' ) ); |
|
1095 | } |
|
1096 | ||
1097 | if ( strlen( $post->post_password ) && !current_user_can( 'edit_post', $post->ID ) ) { |
|
1098 | return new WP_Error( 'unauthorized', 'User cannot view password protected post', array( 'status_code' => 403, 'error' => 'password_protected' ) ); |
@@ 294-313 (lines=20) @@ | ||
291 | return new WP_Error( 'unauthorized', 'User cannot view post', 403 ); |
|
292 | } |
|
293 | ||
294 | if ( |
|
295 | -1 == get_option( 'blog_public' ) && |
|
296 | /** |
|
297 | * Filter access to a specific post. |
|
298 | * |
|
299 | * @module json-api |
|
300 | * |
|
301 | * @since 3.4.0 |
|
302 | * |
|
303 | * @param bool current_user_can( 'read_post', $post->ID ) Can the current user access the post. |
|
304 | * @param WP_Post $post Post data. |
|
305 | */ |
|
306 | ! apply_filters( |
|
307 | 'wpcom_json_api_user_can_view_post', |
|
308 | current_user_can( 'read_post', $post->ID ), |
|
309 | $post |
|
310 | ) |
|
311 | ) { |
|
312 | return new WP_Error( 'unauthorized', 'User cannot view post', array( 'status_code' => 403, 'error' => 'private_blog' ) ); |
|
313 | } |
|
314 | ||
315 | if ( strlen( $post->post_password ) && !current_user_can( 'edit_post', $post->ID ) ) { |
|
316 | return new WP_Error( 'unauthorized', 'User cannot view password protected post', array( 'status_code' => 403, 'error' => 'password_protected' ) ); |