From e9ca3c961fe27daab75bdeeca25ca5b4e46ab98f Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 24 Apr 2010 04:24:38 +0000 Subject: [PATCH] Correct "Last Edited by" username, Updates the last edited username upon save rather than upon a edit lock being created. Props rooodini & deepak.seth. Fixes #12736 git-svn-id: https://develop.svn.wordpress.org/trunk@14216 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/post.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 9ca702f989..47e5f137af 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -188,6 +188,8 @@ function edit_post( $post_data = null ) { add_meta( $post_ID ); + update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); + wp_update_post( $post_data ); // Reunite any orphaned attachments with their parent @@ -538,6 +540,8 @@ function wp_write_post() { add_meta( $post_ID ); + add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); + // Reunite any orphaned attachments with their parent // Does this need to be udpated? ~ Mark if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) @@ -1194,10 +1198,7 @@ function wp_set_post_lock( $post_id ) { $now = time(); - if ( !add_post_meta( $post->ID, '_edit_lock', $now, true ) ) - update_post_meta( $post->ID, '_edit_lock', $now ); - if ( !add_post_meta( $post->ID, '_edit_last', $current_user->ID, true ) ) - update_post_meta( $post->ID, '_edit_last', $current_user->ID ); + update_post_meta( $post->ID, '_edit_lock', $now ); } /**