ninja_forms_field_text_pre_process

The Ninja Forms ninja forms field text pre process function.

Description

ninja_forms_field_text_pre_process( $field_id, $user_value ); 

Parameters (2)

0. $field_id
The field id.
1. $user_value
The user value.

Usage

  1. if ( !function_exists( 'ninja_forms_field_text_pre_process' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/textbox.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The user value. 
  8. $user_value = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ninja_forms_field_text_pre_process($field_id, $user_value); 
  12.  

Defined (1)

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

/deprecated/includes/fields/textbox.php  
  1. function ninja_forms_field_text_pre_process( $field_id, $user_value ) { 
  2. global $ninja_forms_processing; 
  3. $plugin_settings = nf_get_settings(); 
  4. if( isset( $plugin_settings['invalid_email'] ) ) { 
  5. $invalid_email = __( $plugin_settings['invalid_email'], 'ninja-forms' ); 
  6. }else{ 
  7. $invalid_email = __( 'Please enter a valid email address.', 'ninja-forms' ); 
  8. $field_row = $ninja_forms_processing->get_field_settings( $field_id ); 
  9. $data = $field_row['data']; 
  10. if( isset( $data['email'] ) AND $data['email'] == 1 AND $user_value != '' ) { 
  11. if ( ! is_email( $user_value ) ) { 
  12.  
  13. //Check False Positive 
  14. if ( 'inside' == $data['label_pos'] AND ( $data['label'] . " *" ) == $ninja_forms_processing->get_field_value( $field_id ) ) { 
  15. //False Positive 
  16. } else { 
  17. $ninja_forms_processing->add_error('email-' . $field_id, $invalid_email, $field_id); 
  18. $ninja_forms_processing->add_error('email-general', $invalid_email); 
  19.  
  20. if( ( isset( $data['replyto_email'] ) AND $data['replyto_email'] == 1 ) OR ( isset( $data['from_email'] ) AND $data['from_email'] == 1 ) ) { 
  21. $user_value = $ninja_forms_processing->get_field_value( $field_id ); 
  22. $ninja_forms_processing->update_form_setting( 'admin_email_replyto', $user_value ); 
  23.  
  24. if( isset( $data['from_name'] ) AND $data['from_name'] == 1 ) { 
  25. $user_value = $ninja_forms_processing->get_field_value( $field_id ); 
  26. if( $ninja_forms_processing->get_form_setting( 'admin_email_name' ) ) { 
  27. $admin_email_name = $ninja_forms_processing->get_form_setting( 'admin_email_name' ); 
  28. $admin_email_name .= " ".$user_value; 
  29. }else{ 
  30. $admin_email_name = $user_value; 
  31. $ninja_forms_processing->update_form_setting( 'admin_email_name', $admin_email_name );