Ticket #23697: 23697-8.patch
File 23697-8.patch, 5.1 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/misc.php
569 569 function wp_check_locked_posts( $response, $data, $screen_id ) { 570 570 $checked = array(); 571 571 572 if ( 'edit-post' == $screen_id && array_key_exists( 'wp-check-locked', $data ) && is_array( $data['wp-check-locked'] ) ) { 573 foreach ( $data['wp-check-locked'] as $key ) { 574 $post_id = (int) substr( $key, 5 ); 572 if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) { 573 foreach ( $data['wp-check-locked-posts'] as $key ) { 574 if ( ! $post_id = absint( substr( $key, 5 ) ) ) 575 continue; 575 576 576 if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id )) ) {577 if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) { 577 578 $send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) ); 578 579 579 580 if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) … … 585 586 } 586 587 587 588 if ( ! empty( $checked ) ) 588 $response['wp-check-locked '] = $checked;589 $response['wp-check-locked-posts'] = $checked; 589 590 590 591 return $response; 591 592 } … … 597 598 * @since 3.6 598 599 */ 599 600 function wp_refresh_post_lock( $response, $data, $screen_id ) { 600 if ( 'post' == $screen_id &&array_key_exists( 'wp-refresh-post-lock', $data ) ) {601 if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) { 601 602 $received = $data['wp-refresh-post-lock']; 602 603 $send = array(); 603 604 604 if ( ! $post_id = absint( $received['post_id'] ) )605 if ( ! $post_id = absint( $received['post_id'] ) ) 605 606 return $response; 606 607 607 if ( ! current_user_can('edit_post', $post_id) )608 if ( ! current_user_can('edit_post', $post_id) ) 608 609 return $response; 609 610 610 611 if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) { -
wp-admin/includes/post.php
1202 1202 $locked = false; 1203 1203 } 1204 1204 1205 if ( $locked && ( $sendback = wp_get_referer() ) && 1206 false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { 1207 1208 $sendback_text = __('Go back'); 1209 } else { 1210 $sendback = admin_url( 'edit.php' ); 1211 1212 if ( 'post' != $post->post_type && ( $post_type_object = get_post_type_object( $post->post_type ) ) ) { 1213 $sendback .= '?post_type=' . $post->post_type; 1214 $sendback_text = sprintf( _x('Go to All %s', 'post type general name: Posts, Pages, etc.'), $post_type_object->labels->name ); 1215 } else { 1216 $sendback_text = __('Go to All Posts'); 1217 } 1218 } 1219 1205 1220 $hidden = $locked ? '' : ' hidden'; 1206 1221 1207 1222 ?> … … 1229 1244 <p class="currently-editing wp-tab-first" tabindex="0"><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p> 1230 1245 <?php do_action( 'post_lock_text', $post ); ?> 1231 1246 <p> 1232 <a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>1247 <a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a> 1233 1248 <a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a> 1234 1249 <?php 1235 1250 … … 1254 1269 <span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span> 1255 1270 </p> 1256 1271 <?php do_action( 'post_lock_text', $post ); ?> 1257 <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>1272 <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p> 1258 1273 </div> 1259 1274 <?php 1260 1275 } -
wp-admin/js/inline-edit-post.js
293 293 $( document ).ready( function(){ inlineEditPost.init(); } ); 294 294 295 295 // Show/hide locks on posts 296 $( document ).on( 'heartbeat-tick.wp-check-locked ', function( e, data ) {297 var locked = data['wp-check-locked '] || {};296 $( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) { 297 var locked = data['wp-check-locked-posts'] || {}; 298 298 299 299 $('#the-list tr').each( function(i, el) { 300 300 var key = el.id, row = $(el), lock_data, avatar; … … 315 315 row.find('.column-title .locked-avatar').empty(); 316 316 } 317 317 }); 318 }).on( 'heartbeat-send.wp-check-locked ', function( e, data ) {318 }).on( 'heartbeat-send.wp-check-locked-posts', function( e, data ) { 319 319 var check = []; 320 320 321 321 $('#the-list tr').each( function(i, el) { … … 324 324 }); 325 325 326 326 if ( check.length ) 327 data['wp-check-locked '] = check;327 data['wp-check-locked-posts'] = check; 328 328 }); 329 329 330 330 }(jQuery));