@@ 379-387 (lines=9) @@ | ||
376 | if ( 0 < $post_id ) { |
|
377 | $post = get_post( $post_id ); |
|
378 | ||
379 | if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { |
|
380 | return new \WP_Error( |
|
381 | 'block_cannot_read', |
|
382 | __( 'Sorry, you are not allowed to read blocks of this post.', 'carbon-fields' ), |
|
383 | array( |
|
384 | 'status' => rest_authorization_required_code(), |
|
385 | ) |
|
386 | ); |
|
387 | } |
|
388 | } else { |
|
389 | if ( ! current_user_can( 'edit_posts' ) ) { |
|
390 | return new \WP_Error( |
|
@@ 388-398 (lines=11) @@ | ||
385 | ) |
|
386 | ); |
|
387 | } |
|
388 | } else { |
|
389 | if ( ! current_user_can( 'edit_posts' ) ) { |
|
390 | return new \WP_Error( |
|
391 | 'block_cannot_read', |
|
392 | __( 'Sorry, you are not allowed to read blocks as this user.', 'carbon-fields' ), |
|
393 | array( |
|
394 | 'status' => rest_authorization_required_code(), |
|
395 | ) |
|
396 | ); |
|
397 | } |
|
398 | } |
|
399 | ||
400 | return true; |
|
401 | } |