NF_Fields_Email

Class NF_Fields_Email.

Defined (1)

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

/includes/Fields/Email.php  
  1. class NF_Fields_Email extends NF_Abstracts_UserInfo 
  2. protected $_name = 'email'; 
  3.  
  4. protected $_nicename = 'Email'; 
  5.  
  6. protected $_type = 'email'; 
  7.  
  8. protected $_section = 'userinfo'; 
  9.  
  10. protected $_icon = 'envelope-o'; 
  11.  
  12. protected $_templates = 'email'; 
  13.  
  14. protected $_test_value = 'foo@bar.dev'; 
  15.  
  16. public function __construct() 
  17. parent::__construct(); 
  18.  
  19. $this->_nicename = __( 'Email', 'ninja-forms' ); 
  20.  
  21.  
  22. public function filter_default_value( $default_value, $field_class, $settings ) 
  23. if( ! isset( $settings[ 'default_type' ] ) || 
  24. 'user-meta' != $settings[ 'default_type' ] || 
  25. $this->_name != $field_class->get_name()) return $default_value; 
  26.  
  27. $current_user = wp_get_current_user(); 
  28.  
  29. if( $current_user ) { 
  30. $default_value = $current_user->user_email; 
  31.  
  32. return $default_value;