| 1134 | | $cap = ($publish) ? 'publish_posts' : 'edit_posts'; |
| 1135 | | $user = set_current_user(0, $user_login); |
| 1136 | | if ( !current_user_can($cap) ) |
| 1137 | | return new IXR_Error(401, __('Sorry, you are not allowed to post on this blog.')); |
| | 1135 | $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; |
| | 1136 | $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' ); |
| | 1137 | $post_type = 'post'; |
| | 1138 | if( !empty( $content_struct['post_type'] ) ) { |
| | 1139 | if( $content_struct['post_type'] == 'page' ) { |
| | 1140 | $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; |
| | 1141 | $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' ); |
| | 1142 | $post_type = 'page'; |
| | 1143 | } |
| | 1144 | elseif( $content_type['post_type'] == 'post' ) { |
| | 1145 | // This is the default, no changes needed |
| | 1146 | } |
| | 1147 | else { |
| | 1148 | // No other post_type values are allowed here |
| | 1149 | return new IXR_Error( 401, __( 'Invalid post type.' ) ); |
| | 1150 | } |
| | 1151 | } |
| 1374 | | $user = set_current_user(0, $user_login); |
| 1375 | | |
| 1376 | | // The post_type defaults to post, but could also be page. |
| 1377 | | $post_type = "post"; |
| 1378 | | if( |
| 1379 | | !empty($content_struct["post_type"]) |
| 1380 | | && ($content_struct["post_type"] == "page") |
| 1381 | | ) { |
| 1382 | | if( !current_user_can( 'edit_page', $post_ID ) ) { |
| 1383 | | return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page."))); |
| | 1384 | $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; |
| | 1385 | $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' ); |
| | 1386 | $post_type = 'post'; |
| | 1387 | if( !empty( $content_struct['post_type'] ) ) { |
| | 1388 | if( $content_struct['post_type'] == 'page' ) { |
| | 1389 | $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; |
| | 1390 | $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' ); |
| | 1391 | $post_type = 'page'; |