ninja_forms_get_sub_by_id

Ninja_forms_get_sub_by_id( $sub_id ) has been deprecated in favour of Ninja_Forms()->sub( 23 );.

Description

ninja_forms_get_sub_by_id( $sub_id ); 

Parameters (1)

0. $sub_id
The sub id.

Usage

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

Defined (1)

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

/deprecated/includes/deprecated.php  
  1. function ninja_forms_get_sub_by_id( $sub_id ) { 
  2. $sub = Ninja_Forms()->sub( $sub_id ); 
  3. if ( $sub ) { 
  4. $sub_row = array(); 
  5. $data = array(); 
  6. $sub_row['id'] = $sub_id; 
  7. $sub_row['user_id'] = $sub->user_id; 
  8. $sub_row['form_id'] = $sub->form_id; 
  9. $sub_row['action'] = $sub->action; 
  10.  
  11. if ( $sub->action == 'submit' ) { 
  12. $sub_row['status'] = 1; 
  13. } else { 
  14. $sub_row['status'] = 0; 
  15.  
  16. $meta = get_post_custom( $sub_id ); 
  17.  
  18. foreach ( $meta as $key => $array ) { 
  19. if ( strpos( $key, '_field_' ) !== false ) { 
  20. $field_id = str_replace( '_field_', '', $key ); 
  21. $user_value = is_serialized( $array[0] ) ? unserialize( $array[0] ) : $array[0]; 
  22. $data[] = array( 'field_id' => $field_id, 'user_value' => $user_value ); 
  23.  
  24. $sub_row['data'] = $data; 
  25. $sub_row['date_updated'] = $sub->date_submitted; 
  26.  
  27. return $sub_row; 
  28. } else { 
  29. return false;