| 984 | | // The post_type defaults to post, but could also be page. |
| 985 | | $post_type = "post"; |
| 986 | | if( |
| 987 | | !empty($content_struct["post_type"]) |
| 988 | | && ($content_struct["post_type"] == "page") |
| 989 | | ) { |
| 990 | | $post_type = "page"; |
| | 980 | $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; |
| | 981 | $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' ); |
| | 982 | $post_type = 'post'; |
| | 983 | if( !empty( $content_struct['post_type'] ) ) { |
| | 984 | if( $content_struct['post_type'] == 'page' ) { |
| | 985 | $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; |
| | 986 | $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' ); |
| | 987 | $post_type = 'page'; |
| | 988 | } |
| | 989 | elseif( $content_type['post_type'] == 'post' ) { |
| | 990 | // This is the default, no changes needed |
| | 991 | } |
| | 992 | else { |
| | 993 | // No other post_type values are allowed here |
| | 994 | return new IXR_Error( 401, __( 'Invalid post type.' ) ); |
| | 995 | } |
| 1193 | | // The post_type defaults to post, but could also be page. |
| 1194 | | $post_type = "post"; |
| 1195 | | if( |
| 1196 | | !empty($content_struct["post_type"]) |
| 1197 | | && ($content_struct["post_type"] == "page") |
| 1198 | | ) { |
| 1199 | | if( !current_user_can( 'edit_page', $post_ID ) ) { |
| 1200 | | return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page."))); |
| | 1201 | $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; |
| | 1202 | $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' ); |
| | 1203 | $post_type = 'post'; |
| | 1204 | if( !empty( $content_struct['post_type'] ) ) { |
| | 1205 | if( $content_struct['post_type'] == 'page' ) { |
| | 1206 | $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; |
| | 1207 | $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' ); |
| | 1208 | $post_type = 'page'; |