bp_docs_current_user_can

Determine whether the current user can do something the current doc.

Description

bp_docs_current_user_can( (string) $action = 'edit', (bool) $doc_id = false ); 

Parameters (2)

0. $action — Optional. (string) => 'edit'
The cap being tested
1. $doc_id — Optional. (bool) => false
The doc id.

Usage

  1. if ( !function_exists( 'bp_docs_current_user_can' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-docs/includes/functions.php'; 
  3.  
  4. // The cap being tested 
  5. $action = 'edit'; 
  6.  
  7. // The doc id. 
  8. $doc_id = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_docs_current_user_can($action, $doc_id); 
  12.  

Defined (1)

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

/includes/functions.php  
  1. function bp_docs_current_user_can( $action = 'edit', $doc_id = false ) { 
  2. _deprecated_function( __FUNCTION__, '1.8', 'Use current_user_can() with "bp_docs_" prefixed capabilities instead.' ); 
  3.  
  4. $user_can = bp_docs_user_can( $action, bp_loggedin_user_id(), $doc_id ); 
  5.  
  6. return apply_filters( 'bp_docs_current_user_can', $user_can, $action );