Changeset 12068
- Timestamp:
- 10/20/2009 05:00:34 PM (15 years ago)
- Location:
- branches/2.8/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.8/wp-admin/includes/post.php
r11872 r12068 1058 1058 if ( !add_post_meta( $post->ID, '_edit_last', $current_user->ID, true ) ) 1059 1059 update_post_meta( $post->ID, '_edit_last', $current_user->ID ); 1060 } 1061 1062 /** 1063 * Outputs the notice message to say that someone else is editing this post at the moment. 1064 * 1065 * @since 2.8.5 1066 * @return none 1067 */ 1068 function _admin_notice_post_locked() { 1069 global $post; 1070 $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) ); 1071 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 1072 1073 switch ($post->post_type) { 1074 case 'post': 1075 $message = __( 'Warning: %s is currently editing this post' ); 1076 break; 1077 case 'page': 1078 $message = __( 'Warning: %s is currently editing this page' ); 1079 break; 1080 default: 1081 $message = __( 'Warning: %s is currently editing this.' ); 1082 } 1083 1084 $message = sprintf( $message, esc_html( $last_user_name ) ); 1085 echo "<div class='error'><p>$message</p></div>"; 1060 1086 } 1061 1087 -
branches/2.8/wp-admin/page.php
r11380 r12068 99 99 if ( current_user_can('edit_page', $page_ID) ) { 100 100 if ( $last = wp_check_post_lock( $post->ID ) ) { 101 $last_user = get_userdata( $last ); 102 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 103 $message = sprintf( __( 'Warning: %s is currently editing this page' ), esc_html( $last_user_name ) ); 104 $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" ); 105 add_action('admin_notices', create_function( '', "echo '$message';" ) ); 101 add_action('admin_notices', '_admin_notice_post_locked' ); 106 102 } else { 107 103 wp_set_post_lock( $post->ID ); -
branches/2.8/wp-admin/post.php
r11380 r12068 134 134 if ( current_user_can('edit_post', $post_ID) ) { 135 135 if ( $last = wp_check_post_lock( $post->ID ) ) { 136 $last_user = get_userdata( $last ); 137 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 138 $message = sprintf( __( 'Warning: %s is currently editing this post' ), esc_html( $last_user_name ) ); 139 $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" ); 140 add_action('admin_notices', create_function( '', "echo '$message';" ) ); 136 add_action('admin_notices', '_admin_notice_post_locked' ); 141 137 } else { 142 138 wp_set_post_lock( $post->ID );
Note: See TracChangeset
for help on using the changeset viewer.