bp_docs_edit_lock_redirect

Prevent a user from visiting the Edit page if it's locked.

Description

bp_docs_edit_lock_redirect(); 

Usage

  1. if ( !function_exists( 'bp_docs_edit_lock_redirect' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-docs/includes/edit-lock.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_docs_edit_lock_redirect(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/edit-lock.php  
  1. function bp_docs_edit_lock_redirect() { 
  2. if ( ! bp_docs_is_doc_edit() ) { 
  3. return; 
  4.  
  5. $doc_id = get_queried_object_id(); 
  6.  
  7. $lock = bp_docs_check_post_lock( $doc_id ); 
  8.  
  9. if ( ! empty( $lock ) && $lock != bp_loggedin_user_id() ) { 
  10. $bounce = bp_docs_get_doc_link( $doc_id ); 
  11. wp_redirect( $bounce );