| @@ -108,12 +108,17 @@ | ||
| 108 | 108 | if ( $action !== $this->action_name ) { |
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | + // Bail if the current user cannot edit the Post being exported. | |
| 113 | + if ( ! current_user_can( 'edit_post', $post_id ) ) { | |
| 114 | + wp_die( esc_html__( 'Sorry, you are not allowed to export this Post.', 'convertkit' ) ); | |
| 115 | + } | |
| 116 | + | |
| 112 | 117 | // Export Post to a draft ConvertKit Broadcast. |
| 113 | 118 | $result = $this->export_post_to_broadcast( $post_id ); |
| 114 | 119 | |
| 115 | - // If an error occured, display an error message. | |
| 120 | + // If an error occurred, display an error message. | |
| 116 | 121 | if ( is_wp_error( $result ) ) { |
| 117 | 122 | wp_die( esc_html( $result->get_error_message() ) ); |
| 118 | 123 | } |
| 119 | 124 | |
| @@ -236,9 +241,9 @@ | ||
| 236 | 241 | $content, |
| 237 | 242 | $post->post_excerpt |
| 238 | 243 | ); |
| 239 | 244 | |
| 240 | - // If an error occured, return it now. | |
| 245 | + // If an error occurred, return it now. | |
| 241 | 246 | if ( is_wp_error( $result ) ) { |
| 242 | 247 | return $result; |
| 243 | 248 | } |
| 244 | 249 | |