NF_Fields_FirstName

Class NF_Fields_FirstName.

Defined (1)

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

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