mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-10 18:37:58 +01:00
Post locks:
- When a post is locked, ensure the 'Go back' button doesn't reload the same screen. If no referrer, change the button from 'Go back' to 'Go to All Posts'/'Go to All Pages' etc. - Remove restriction on checking locks only for posts. See #23697. git-svn-id: http://core.svn.wordpress.org/trunk@24408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ea4aa44ed1
commit
5642a56311
@ -569,11 +569,12 @@ add_action('admin_head', '_ipad_meta');
|
||||
function wp_check_locked_posts( $response, $data, $screen_id ) {
|
||||
$checked = array();
|
||||
|
||||
if ( 'edit-post' == $screen_id && array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
|
||||
if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
|
||||
foreach ( $data['wp-check-locked-posts'] as $key ) {
|
||||
$post_id = (int) substr( $key, 5 );
|
||||
if ( ! $post_id = absint( substr( $key, 5 ) ) )
|
||||
continue;
|
||||
|
||||
if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
|
||||
if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) {
|
||||
$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
|
||||
|
||||
if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) )
|
||||
@ -597,7 +598,7 @@ add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 );
|
||||
* @since 3.6
|
||||
*/
|
||||
function wp_refresh_post_lock( $response, $data, $screen_id ) {
|
||||
if ( 'post' == $screen_id && array_key_exists( 'wp-refresh-post-lock', $data ) ) {
|
||||
if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
|
||||
$received = $data['wp-refresh-post-lock'];
|
||||
$send = array();
|
||||
|
||||
@ -636,7 +637,7 @@ add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );
|
||||
* @since 3.6
|
||||
*/
|
||||
function wp_refresh_post_nonces( $response, $data, $screen_id ) {
|
||||
if ( 'post' == $screen_id && array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
|
||||
if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
|
||||
$received = $data['wp-refresh-post-nonces'];
|
||||
|
||||
if ( ! $post_id = absint( $received['post_id'] ) )
|
||||
|
@ -1202,6 +1202,21 @@ function _admin_notice_post_locked() {
|
||||
$locked = false;
|
||||
}
|
||||
|
||||
if ( $locked && ( $sendback = wp_get_referer() ) &&
|
||||
false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
|
||||
|
||||
$sendback_text = __('Go back');
|
||||
} else {
|
||||
$sendback = admin_url( 'edit.php' );
|
||||
|
||||
if ( 'post' != $post->post_type && ( $post_type_object = get_post_type_object( $post->post_type ) ) ) {
|
||||
$sendback .= '?post_type=' . $post->post_type;
|
||||
$sendback_text = sprintf( _x('Go to All %s', 'post type general name: Posts, Pages, etc.'), $post_type_object->labels->name );
|
||||
} else {
|
||||
$sendback_text = __('Go to All Posts');
|
||||
}
|
||||
}
|
||||
|
||||
$hidden = $locked ? '' : ' hidden';
|
||||
|
||||
?>
|
||||
@ -1229,7 +1244,7 @@ function _admin_notice_post_locked() {
|
||||
<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" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a>
|
||||
<a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
|
||||
<?php
|
||||
|
||||
@ -1254,7 +1269,7 @@ function _admin_notice_post_locked() {
|
||||
<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>
|
||||
<p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user