Ticket #8592: 8592.5.diff
| File 8592.5.diff, 9.1 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/post.php
2715 2715 if ( empty($post_type) ) 2716 2716 $post_type = 'post'; 2717 2717 2718 if ( isset($post_parent) ) 2719 $post_parent = (int) $post_parent; 2720 else 2721 $post_parent = 0; 2722 2723 // Check the post_parent to see if it will cause a hierarchy loop 2724 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr ); 2725 2726 // Check to see if the post parent is unpublished. If so, set this post status to match. 2727 if ( isset($post_parent) && $post_parent ) { 2728 $post_parent_object = get_post( $post_parent ); 2729 if ( 'publish' !== $post_parent_object->post_status ) { 2730 $post_status = $post_parent_object->post_status; 2731 } 2732 // Set this post's password if its parent had one. 2733 if ( !empty($post_parent_object->post_password) ) 2734 $post_password = $post_parent_object->post_password; 2735 } 2718 2736 if ( empty($post_status) ) 2719 2737 $post_status = 'draft'; 2720 2738 … … 2810 2828 2811 2829 if ( ! isset($pinged) ) 2812 2830 $pinged = ''; 2813 2814 if ( isset($post_parent) )2815 $post_parent = (int) $post_parent;2816 else2817 $post_parent = 0;2818 2819 // Check the post_parent to see if it will cause a hierarchy loop2820 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );2821 2831 2822 2832 if ( isset($menu_order) ) 2823 2833 $menu_order = (int) $menu_order; -
src/wp-admin/js/post.js
515 515 if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) { 516 516 publishOn = postL10n.publishOnFuture; 517 517 $('#publish').val( postL10n.schedule ); 518 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {518 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' && $('#unpublished_parent').val() != 1 ) { 519 519 publishOn = postL10n.publishOn; 520 520 $('#publish').val( postL10n.publish ); 521 521 } else { -
src/wp-includes/post-template.php
784 784 ); 785 785 786 786 $r = wp_parse_args( $args, $defaults ); 787 $r = apply_filters( 'wp_dropdown_pages_args', $r ); 788 if ( is_admin() ) { 789 // revert to default (public) post_status on the Reading Settings page 790 if ( 'options-reading' == get_current_screen()->base ) 791 unset( $r['post_status'] ); 792 } 787 793 extract( $r, EXTR_SKIP ); 788 794 789 795 $pages = get_pages($r); … … 829 835 ); 830 836 831 837 $r = wp_parse_args( $args, $defaults ); 838 $r = apply_filters( 'wp_list_pages_args', $r ); 832 839 extract( $r, EXTR_SKIP ); 833 840 834 841 $output = ''; -
src/wp-includes/js/autosave.js
176 176 177 177 if ( res.responses[0].data ) // update autosave message 178 178 jQuery('.autosave-message').text( res.responses[0].data ); 179 180 if ( res.responses[0].supplemental.parent_status ) // update hidden unpublished_parent field 181 jQuery('#unpublished_parent').val( res.responses[0].supplemental.parent_status ); 179 182 } 180 183 } 181 184 -
src/wp-admin/includes/ajax-actions.php
1082 1082 $id = $post->ID; 1083 1083 } 1084 1084 1085 $parent_status = get_post_status( $post->post_parent ); 1086 $parent_password = get_post_field( 'post_password', $post->post_parent ); 1087 if ( $parent_status !== 'publish' ) 1088 $supplemental['replace-unpublished_parent'] = 1; 1089 elseif ( !empty($parent_password) ) 1090 $supplemental['replace-unpublished_parent'] = 2; 1091 1085 1092 if ( ! is_wp_error($id) ) { 1086 1093 /* translators: draft saved date format, see http://php.net/date */ 1087 1094 $draft_saved_date_format = __('g:i:s a'); -
src/wp-admin/includes/meta-boxes.php
15 15 $post_type = $post->post_type; 16 16 $post_type_object = get_post_type_object($post_type); 17 17 $can_publish = current_user_can($post_type_object->cap->publish_posts); 18 $unpublished_parent = 0; 19 if ( isset( $post->post_parent ) && $post->post_parent ) { 20 $parent_status = get_post_status( $post->post_parent ); 21 $parent_password = get_post_field( 'post_password', $post->post_parent ); 22 if ( 'publish' !== $parent_status ) { 23 $unpublished_parent = 1; 24 $post->post_status = $parent_status; 25 } 26 elseif ( !empty( $parent_password ) ) { 27 $unpublished_parent = 2; 28 } 29 } 18 30 ?> 19 31 <div class="submitbox" id="submitpost"> 20 32 … … 23 35 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> 24 36 <div style="display:none;"> 25 37 <?php submit_button( __( 'Save' ), 'button', 'save' ); ?> 38 <input type="hidden" name="unpublished_parent" id="unpublished_parent" value="<?php echo 39 esc_attr($unpublished_parent); ?>" /> 26 40 </div> 27 41 28 42 <div id="minor-publishing-actions"> … … 124 138 } 125 139 126 140 echo esc_html( $visibility_trans ); ?></span> 127 <?php if ( $can_publish ) { ?> 141 <?php if ( 1 == $unpublished_parent ) { ?> 142 <p><?php printf('To publish this page, you must first <a href="%s">publish its parent page</a>.', get_edit_post_link( $post->post_parent ) ); ?></p> 143 <?php } elseif ( $can_publish ) { ?> 128 144 <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a> 129 145 130 146 <div id="post-visibility-select" class="hide-if-js"> 147 <?php if ( 2 == $unpublished_parent ) { ?> 148 <p><?php printf('This is a child of <a href="%s">a password-protected page</a>. To remove this page\'s password, you must first remove its parent\'s.', get_edit_post_link( $post->post_parent ) ); ?></p> 149 <?php } ?> 131 150 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" /> 132 151 <?php if ($post_type == 'post'): ?> 133 152 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> 134 153 <?php endif; ?> 135 154 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> 136 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />155 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> <?php if ( 2 == $unpublished_parent ) echo 'disabled'; ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br /> 137 156 <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?> 138 157 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> 139 158 <?php endif; ?> 140 159 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br /> 141 160 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" maxlength="20" /><br /></span> 142 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />161 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> <?php if ( 2 == $unpublished_parent ) echo 'disabled'; ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br /> 143 162 144 163 <p> 145 164 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> … … 220 239 <div id="publishing-action"> 221 240 <span class="spinner"></span> 222 241 <?php 223 if ( ! in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {242 if ( !$unpublished_parent && !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { 224 243 if ( $can_publish ) : 225 244 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> 226 245 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />