Post locks:

- Show 'Saving revision...' while autosaving after a post has been taken over. Change to 'Your latest changes were saved as a revision.' when autosave completes.
- Make sure a user exists before using $user->display_name.
- Add 'post_lock_text' action for extending the message text.

git-svn-id: http://core.svn.wordpress.org/trunk@24042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2013-04-22 03:08:51 +00:00
parent 2a4474f4de
commit d2a8f064aa
5 changed files with 37 additions and 13 deletions

View File

@@ -1197,8 +1197,7 @@ function _admin_notice_post_locked() {
if ( ! $post = get_post() )
return;
if ( $user = wp_check_post_lock( $post->ID ) ) {
$user = get_userdata( $user );
if ( ( $user_id = wp_check_post_lock( $post->ID ) ) && ( $user = get_userdata( $user_id ) ) ) {
$locked = apply_filters( 'show_post_locked_dialog', true, $post, $user );
} else {
$locked = false;
@@ -1229,6 +1228,7 @@ function _admin_notice_post_locked() {
<div class="post-locked-message">
<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
<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>
<?php do_action( 'post_lock_text', $post ); ?>
<p>
<a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
<a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
@@ -1249,7 +1249,12 @@ function _admin_notice_post_locked() {
?>
<div class="post-taken-over">
<div class="post-locked-avatar"></div>
<p class="currently-editing wp-tab-first" tabindex="0"></p>
<p class="wp-tab-first" tabindex="0">
<span class="currently-editing"></span><br>
<span class="locked-saving hidden"><img src="images/wpspin_light-2x.gif" width="16" height="16" /> <?php _e('Saving revision...'); ?></span>
<span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span>
</p>
<?php do_action( 'post_lock_text', $post ); ?>
<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>
</div>
<?php