@@ 428-436 (lines=9) @@ | ||
425 | if ( 0 < $post_id ) { |
|
426 | $post = get_post( $post_id ); |
|
427 | ||
428 | if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { |
|
429 | return new \WP_Error( |
|
430 | 'block_cannot_read', |
|
431 | __( 'Sorry, you are not allowed to read blocks of this post.', 'carbon-fields' ), |
|
432 | array( |
|
433 | 'status' => rest_authorization_required_code(), |
|
434 | ) |
|
435 | ); |
|
436 | } |
|
437 | } else { |
|
438 | if ( ! current_user_can( 'edit_posts' ) ) { |
|
439 | return new \WP_Error( |
|
@@ 437-447 (lines=11) @@ | ||
434 | ) |
|
435 | ); |
|
436 | } |
|
437 | } else { |
|
438 | if ( ! current_user_can( 'edit_posts' ) ) { |
|
439 | return new \WP_Error( |
|
440 | 'block_cannot_read', |
|
441 | __( 'Sorry, you are not allowed to read blocks as this user.', 'carbon-fields' ), |
|
442 | array( |
|
443 | 'status' => rest_authorization_required_code(), |
|
444 | ) |
|
445 | ); |
|
446 | } |
|
447 | } |
|
448 | ||
449 | return true; |
|
450 | } |