Changeset 9473 for trunk/wp-admin/includes/post.php
- Timestamp:
- 11/02/2008 01:56:32 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r9469 r9473 1003 1003 function post_preview() { 1004 1004 1005 $_POST['post_category'] = explode(",", $_POST['catslist']); 1006 $_POST['tags_input'] = explode(",", $_POST['tags_input']); 1007 if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) 1005 $post_ID = (int) $_POST['post_ID']; 1006 if ( $post_ID < 1 ) 1007 wp_die( __('Preview not available. Please save as draft first.') ); 1008 1009 if ( isset($_POST['catslist']) ) 1010 $_POST['post_category'] = explode(",", $_POST['catslist']); 1011 1012 if ( isset($_POST['tags_input']) ) 1013 $_POST['tags_input'] = explode(",", $_POST['tags_input']); 1014 1015 if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) ) 1008 1016 unset($_POST['post_category']); 1009 1017 1010 if($_POST['post_ID'] < 0) { 1011 $_POST['post_status'] = 'draft'; 1012 $_POST['temp_ID'] = $_POST['post_ID']; 1013 $id = wp_write_post(); 1018 $_POST['ID'] = $post_ID; 1019 $post = get_post($post_ID); 1020 1021 if ( 'page' == $post->post_type ) { 1022 if ( !current_user_can('edit_page', $post_ID) ) 1023 wp_die(__('You are not allowed to edit this page.')); 1014 1024 } else { 1015 $post_ID = (int) $_POST['post_ID']; 1016 $_POST['ID'] = $post_ID; 1017 $post = get_post($post_ID); 1018 1019 if ( 'page' == $post->post_type ) { 1020 if ( !current_user_can('edit_page', $post_ID) ) 1021 die(__('You are not allowed to edit this page.')); 1022 } else { 1023 if ( !current_user_can('edit_post', $post_ID) ) 1024 die(__('You are not allowed to edit this post.')); 1025 } 1026 1027 if ( 'draft' == $post->post_status ) { 1028 $id = edit_post(); 1029 } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. 1030 wp_create_post_autosave( $post->ID ); 1025 if ( !current_user_can('edit_post', $post_ID) ) 1026 wp_die(__('You are not allowed to edit this post.')); 1027 } 1028 1029 if ( 'draft' == $post->post_status ) { 1030 $id = edit_post(); 1031 } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. 1032 $id = wp_create_post_autosave( $post->ID ); 1033 if ( ! is_wp_error($id) ) 1031 1034 $id = $post->ID; 1032 }1033 1035 } 1034 1036
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)