ninja_forms_delete_sub

The Ninja Forms ninja forms delete sub function.

Description

ninja_forms_delete_sub( (string) $sub_id = '' ); 

Parameters (1)

0. $sub_id — Optional. (string) => ''
The sub id.

Usage

  1. if ( !function_exists( 'ninja_forms_delete_sub' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/ajax.php'; 
  3.  
  4. // The sub id. 
  5. $sub_id = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_delete_sub($sub_id); 
  9.  

Defined (1)

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

/deprecated/includes/admin/ajax.php  
  1. function ninja_forms_delete_sub($sub_id = '') { 
  2. global $wpdb; 
  3.  
  4. // Bail if we aren't in the admin 
  5. if ( ! is_admin() ) 
  6. return false; 
  7.  
  8. check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' ); 
  9.  
  10. if($sub_id == '') { 
  11. $ajax = true; 
  12. $sub_id = absint( $_REQUEST['sub_id'] ); 
  13. }else{ 
  14. $ajax = false; 
  15.  
  16. $wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_SUBS_TABLE_NAME." WHERE id = %d", $sub_id)); 
  17. if( $ajax ) { 
  18. die();