ninja_forms_pre_process_populate_term

The Ninja Forms ninja forms pre process populate term function.

Description

ninja_forms_pre_process_populate_term( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

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

Defined (1)

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

/deprecated/includes/display/processing/update-terms.php  
  1. function ninja_forms_pre_process_populate_term( $form_id ) { 
  2. global $ninja_forms_processing; 
  3.  
  4. $add_field = apply_filters( 'ninja_forms_use_post_fields', false ); 
  5. if ( !$add_field ) 
  6. return false; 
  7.  
  8. // Loop through our fields and see if we have a list field. If we do, check for the 'populate_term' setting. 
  9. $field_values = $ninja_forms_processing->get_all_fields(); 
  10. if( is_array( $field_values ) ) { 
  11. foreach( $field_values as $field_id => $user_value ) { 
  12. $field_row = $ninja_forms_processing->get_field_settings( $field_id ); 
  13. $field_type = $field_row['type']; 
  14. $field_data = $field_row['data']; 
  15. if( $field_type == '_list' AND isset( $field_data['populate_term'] ) AND $field_data['populate_term'] != '' ) { 
  16. if( !is_array( $user_value ) ) { 
  17. $user_value = array( $user_value ); 
  18. $ninja_forms_processing->update_form_setting( $field_data['populate_term'].'_terms', $user_value );