ninja_forms_update_sub

Ninja_forms_update_sub() has been deprecated in favour of Ninja_Forms()->sub( 23 )->update_field( id, value ); Because submissions are now a CPT, this function will only return false.

Description

ninja_forms_update_sub( $args ); 

Please replace any instances of this function with the replacement.

Parameters (1)

0. $args
The args.

Usage

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

Defined (1)

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

/deprecated/includes/deprecated.php  
  1. function ninja_forms_update_sub( $args ) { 
  2. if ( ! isset ( $args['sub_id'] ) ) 
  3. return false; 
  4.  
  5. $sub_id = $args['sub_id']; 
  6. $sub = Ninja_Forms()->sub( $sub_id ); 
  7.  
  8. if ( isset ( $args['data'] ) ) { 
  9. $data = $args['data']; 
  10. unset ( $args['data'] ); 
  11.  
  12. if ( is_serialized( $data ) ) { 
  13. $data = unserialize( $data ); 
  14.  
  15. foreach ( $data as $d ) { 
  16. $field_id = $d['field_id']; 
  17. $user_value = $d['user_value']; 
  18. $sub->add_field( $field_id, $user_value ); 
  19. }  
  20.  
  21. foreach ( $args as $key => $value ) { 
  22. $sub->update_meta( '_' . $key, $value ); 
  23.