Changeset 16901
- Timestamp:
- 12/13/2010 09:23:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r16761 r16901 1202 1202 return false; 1203 1203 1204 $lock = get_post_meta( $post->ID, '_edit_lock', true ); 1205 $last = get_post_meta( $post->ID, '_edit_last', true ); 1206 1204 if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) ) 1205 return false; 1206 1207 $lock = explode( ':', $lock ); 1208 $time = $lock[0]; 1209 $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); 1210 1207 1211 $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 ); 1208 1212 1209 if ( $ lock && $lock > time() - $time_window && $last!= get_current_user_id() )1210 return $ last;1213 if ( $time && $time > time() - $time_window && $user != get_current_user_id() ) 1214 return $user; 1211 1215 return false; 1212 1216 } … … 1223 1227 if ( !$post = get_post( $post_id ) ) 1224 1228 return false; 1225 if ( 0 == get_current_user_id() )1229 if ( 0 == ($user_id = get_current_user_id()) ) 1226 1230 return false; 1227 1231 1228 1232 $now = time(); 1229 1230 update_post_meta( $post->ID, '_edit_lock', $now ); 1233 $lock = "$now:$user_id"; 1234 1235 update_post_meta( $post->ID, '_edit_lock', $lock ); 1231 1236 } 1232 1237 … … 1239 1244 function _admin_notice_post_locked() { 1240 1245 global $post; 1241 $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) ); 1246 1247 $lock = explode( ':', get_post_meta( $post->ID, '_edit_lock', true ) ); 1248 $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); 1249 $last_user = get_userdata( $user ); 1242 1250 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 1243 1251
Note: See TracChangeset
for help on using the changeset viewer.