diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index d265f1f049..0fe509ee6d 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -145,6 +145,7 @@ if ( $doaction ) {
$wp_list_table->prepare_items();
wp_enqueue_script('inline-edit-post');
+wp_enqueue_script('edit-post');
$title = $post_type_object->labels->name;
diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
index 47a8aeba0e..8b75704c23 100644
--- a/wp-admin/includes/class-wp-posts-list-table.php
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -555,7 +555,7 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( $lock_holder && $can_edit_post && $post->post_status != 'trash' ) {
printf( '%s',
- esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ) );
+ esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ) );
}
if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php
index f500ca16e1..d0f2ed7d16 100644
--- a/wp-admin/includes/misc.php
+++ b/wp-admin/includes/misc.php
@@ -561,3 +561,29 @@ function _ipad_meta() {
}
}
add_action('admin_head', '_ipad_meta');
+
+/**
+ * Check lock status for posts displayed on the Posts screen
+ *
+ * @since 3.6
+ */
+function wp_check_locked_posts( $response, $data ) {
+ $checked = array();
+
+ if ( array_key_exists( 'wp-check-locked', $data ) && is_array( $data['wp-check-locked'] ) ) {
+ foreach ( $data['wp-check-locked'] as $key ) {
+ $post_id = (int) substr( $key, 5 );
+
+ if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) ) {
+ if ( $user = get_userdata( $user_id ) )
+ $checked[$key] = sprintf( __( '%s is currently editing' ), $user->display_name );
+ }
+ }
+ }
+
+ if ( ! empty( $checked ) )
+ $response['wp-check-locked'] = $checked;
+
+ return $response;
+}
+add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 2 );
diff --git a/wp-admin/js/edit-post.js b/wp-admin/js/edit-post.js
new file mode 100644
index 0000000000..ef581c7c39
--- /dev/null
+++ b/wp-admin/js/edit-post.js
@@ -0,0 +1,25 @@
+(function($){
+ $( document ).on( 'heartbeat-tick.wp-check-locked', function( e, data ) {
+ var locked = data['wp-check-locked'] || {};
+
+ $('#the-list tr').each( function(i, el) {
+ var key = el.id, row = $(el);
+
+ if ( locked.hasOwnProperty( key ) ) {
+ if ( ! row.hasClass('wp-locked') )
+ row.addClass('wp-locked').find('.column-title strong').after( $('').text(locked[key]) );
+ row.find('.check-column checkbox').prop('checked', false);
+ } else if ( row.hasClass('wp-locked') ) {
+ row.removeClass('wp-locked').find('.column-title span.lock-holder').remove();
+ }
+ });
+ }).on( 'heartbeat-send.wp-check-locked', function( e, data ) {
+ var check = [];
+
+ $('#the-list tr').each( function(i, el) {
+ check.push( el.id );
+ });
+
+ data['wp-check-locked'] = check;
+ });
+}(jQuery));
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index cfb865e3c9..d168c2c99a 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -416,6 +416,8 @@ function wp_default_scripts( &$scripts ) {
// @todo: Core no longer uses theme-preview.js. Remove?
$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 );
+ $scripts->add( 'edit-post', "/wp-admin/js/edit-post$suffix.js", array( 'heartbeat' ), false, 1 );
+
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.'),