ninja_forms_check_email_from_name

Function that checks to see if we've properly removed the old "From Email" setting and replaced it with "From Name" and "From Email.".

Description

ninja_forms_check_email_from_name(); 

Usage

  1. if ( !function_exists( 'ninja_forms_check_email_from_name' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/from-setting-check.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_check_email_from_name(); 
  7.  

Defined (1)

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

/deprecated/includes/from-setting-check.php  
  1. function ninja_forms_check_email_from_name() { 
  2.  
  3. $plugin_settings = nf_get_settings(); 
  4. // Check to see if we've already fixed the setting. 
  5. if ( !isset ( $plugin_settings['fix_form_email_from'] ) or $plugin_settings['fix_form_email_from'] != 1 ) { 
  6. // Get our forms. 
  7. if ( is_array ( $forms ) ) { 
  8. foreach( $forms as $form ) { 
  9. // Check to see if we've already added the "from_email_name." 
  10. if ( !isset ( $form['data']['email_from_name'] ) and isset ( $form['data']['email_from'] ) ) { 
  11. // This field doesn't have an "email_from_name" saved, so we'll run it through the adjustment function. 
  12. $email_from = ninja_forms_split_email_from( $form['data']['email_from'] ); 
  13. $form['data']['email_from'] = $email_from['email_from']; 
  14. $form['data']['email_from_name'] = $email_from['email_from_name']; 
  15. $args = array( 
  16. 'update_array' => array( 
  17. 'data' => serialize( $form['data'] ),  
  18. ),  
  19. 'where' => array( 
  20. 'id' => $form['id'],  
  21. ),  
  22. ); 
  23. $plugin_settings['fix_form_email_from'] = 1; 
  24. update_option( 'ninja_forms_settings', $plugin_settings );