Changeset 2846
- Timestamp:
- 09/07/2005 12:20:04 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r2742 r2846 367 367 return $this->error; 368 368 } 369 370 $user_data = get_userdatabylogin($user_login); 371 if (!user_can_create_post($user_data->ID, $blog_ID)) { 369 370 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 371 372 $user = new WP_User($user_login); 373 if ( !$user->has_cap($cap) ) 372 374 return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.'); 373 }374 375 375 376 $post_status = ($publish) ? 'publish' : 'draft'; 376 377 377 $post_author = $user _data->ID;378 $post_author = $user->ID; 378 379 379 380 $post_title = xmlrpc_getposttitle($content); … … 425 426 $this->escape($actual_post); 426 427 427 $post_author_data = get_userdata($actual_post['post_author']); 428 $user_data = get_userdatabylogin($user_login); 429 430 if (!user_can_edit_post($user_data->ID, $post_ID)) { 428 $user = new WP_User($user_login); 429 if ( !$user->has_cap('edit_post', $post_ID) ) 431 430 return new IXR_Error(401, 'Sorry, you do not have the right to edit this post.'); 432 }433 431 434 432 extract($actual_post); … … 476 474 } 477 475 478 $user_data = get_userdatabylogin($user_login); 479 480 if (!user_can_delete_post($user_data->ID, $post_ID)) { 476 $user = new WP_User($user_login); 477 if ( !$user->has_cap('edit_post', $post_ID) ) 481 478 return new IXR_Error(401, 'Sorry, you do not have the right to delete this post.'); 482 }483 479 484 480 $result = wp_delete_post($post_ID); … … 514 510 } 515 511 516 $user _data = get_userdatabylogin($user_login);517 if ( !user_can_create_post($user_data->ID, $blog_ID)) {512 $user = new WP_User($user_login); 513 if ( !$user->has_cap('publish_posts', $post_ID) ) 518 514 return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.'); 519 } 520 521 $post_author = $user_data->ID; 515 516 $post_author = $user->ID; 522 517 523 518 $post_title = $content_struct['title']; … … 595 590 } 596 591 597 $user _data = get_userdatabylogin($user_login);598 if ( !user_can_edit_post($user_data->ID, $post_ID)) {592 $user = new WP_User($user_login); 593 if ( !$user->has_cap('edit_post', $post_ID) ) 599 594 return new IXR_Error(401, 'Sorry, you can not edit this post.'); 600 }601 595 602 596 $postdata = wp_get_single_post($post_ID, ARRAY_A); … … 1015 1009 } 1016 1010 1017 $user _data = get_userdatabylogin($user_login);1018 if ( !user_can_edit_post($user_data->ID, $post_ID)) {1011 $user = new WP_User($user_login); 1012 if ( !$user->has_cap('edit_post', $post_ID) ) 1019 1013 return new IXR_Error(401, 'Sorry, you can not edit this post.'); 1020 }1021 1014 1022 1015 foreach($categories as $cat) { … … 1098 1091 } 1099 1092 1100 $user _data = get_userdatabylogin($user_login);1101 if ( !user_can_edit_post($user_data->ID, $post_ID)) {1093 $user = new WP_User($user_login); 1094 if ( !$user->has_cap('edit_post', $post_ID) ) 1102 1095 return new IXR_Error(401, 'Sorry, you can not edit this post.'); 1103 }1104 1096 1105 1097 $postdata = wp_get_single_post($post_ID,ARRAY_A);
Note: See TracChangeset
for help on using the changeset viewer.