wpcf7_map_meta_cap

The Contact Form 7 wpcf7 map meta cap function.

Description

wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ); 

Parameters (4)

0. $caps
The caps.
1. $cap
The cap.
2. $user_id
The user id.
3. $args
The args.

Usage

  1. if ( !function_exists( 'wpcf7_map_meta_cap' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/capabilities.php'; 
  3.  
  4. // The caps. 
  5. $caps = null; 
  6.  
  7. // The cap. 
  8. $cap = null; 
  9.  
  10. // The user id. 
  11. $user_id = null; 
  12.  
  13. // The args. 
  14. $args = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wpcf7_map_meta_cap($caps, $cap, $user_id, $args); 
  18.  

Defined (1)

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

/includes/capabilities.php  
  1. function wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ) { 
  2. $meta_caps = array( 
  3. 'wpcf7_edit_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,  
  4. 'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,  
  5. 'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,  
  6. 'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,  
  7. 'wpcf7_manage_integration' => 'manage_options',  
  8. ); 
  9.  
  10. $meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps ); 
  11.  
  12. $caps = array_diff( $caps, array_keys( $meta_caps ) ); 
  13.  
  14. if ( isset( $meta_caps[$cap] ) ) { 
  15. $caps[] = $meta_caps[$cap]; 
  16.  
  17. return $caps;