Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_check_post_lock [ WordPress Function ]

wp_check_post_lock ( $post_id )
Parameters:
  • (int) $post_id ID of the post to check for editing
Returns:
  • (bool|int) False: not locked or locked by current user. Int: user ID of user with lock.
Defined at:



Check to see if the post is currently being edited by another user.

Source


<?php
function wp_check_post_lock$post_id ) {
    if ( !
$post get_post$post_id ) )
        return 
false;

    if ( !
$lock get_post_meta$post->ID'_edit_lock'true ) )
        return 
false;

    
$lock explode':'$lock );
    
$time $lock[0];
    
$user = isset( $lock[1] ) ? $lock[1] : get_post_meta$post->ID'_edit_last'true );

    
$time_window apply_filters'wp_check_post_lock_window'AUTOSAVE_INTERVAL );

    if ( 
$time && $time time() - $time_window && $user != get_current_user_id() )
        return 
$user;
    return 
false;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics