@@ 399-407 (lines=9) @@ | ||
396 | if ( 0 < $post_id ) { |
|
397 | $post = get_post( $post_id ); |
|
398 | ||
399 | if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { |
|
400 | return new \WP_Error( |
|
401 | 'block_cannot_read', |
|
402 | __( 'Sorry, you are not allowed to read blocks of this post.', 'carbon-fields' ), |
|
403 | array( |
|
404 | 'status' => rest_authorization_required_code(), |
|
405 | ) |
|
406 | ); |
|
407 | } |
|
408 | } else { |
|
409 | if ( ! current_user_can( 'edit_posts' ) ) { |
|
410 | return new \WP_Error( |
|
@@ 408-418 (lines=11) @@ | ||
405 | ) |
|
406 | ); |
|
407 | } |
|
408 | } else { |
|
409 | if ( ! current_user_can( 'edit_posts' ) ) { |
|
410 | return new \WP_Error( |
|
411 | 'block_cannot_read', |
|
412 | __( 'Sorry, you are not allowed to read blocks as this user.', 'carbon-fields' ), |
|
413 | array( |
|
414 | 'status' => rest_authorization_required_code(), |
|
415 | ) |
|
416 | ); |
|
417 | } |
|
418 | } |
|
419 | ||
420 | return true; |
|
421 | } |