wpcf7_not_allowed_to_edit

The Contact Form 7 wpcf7 not allowed to edit function.

Description

wpcf7_not_allowed_to_edit(); 

Usage

  1. if ( !function_exists( 'wpcf7_not_allowed_to_edit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/admin/admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpcf7_not_allowed_to_edit(); 
  7.  

Defined (1)

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

/admin/admin.php  
  1. function wpcf7_not_allowed_to_edit() { 
  2. if ( ! $contact_form = wpcf7_get_current_contact_form() ) { 
  3. return; 
  4.  
  5. $post_id = $contact_form->id(); 
  6.  
  7. if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { 
  8. return; 
  9.  
  10. $message = __( "You are not allowed to edit this contact form.",  
  11. 'contact-form-7' ); 
  12.  
  13. echo sprintf( 
  14. '<div class="notice notice-warning"><p>%s</p></div>',  
  15. esc_html( $message ) );