NF_Fields_LastName

Class NF_Fields_FirstName.

Defined (1)

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

/includes/Fields/LastName.php  
  1. class NF_Fields_LastName extends NF_Abstracts_UserInfo 
  2. protected $_name = 'lastname'; 
  3. protected $_type = 'lastname'; 
  4.  
  5. protected $_nicename = 'Last Name'; 
  6.  
  7. protected $_section = 'userinfo'; 
  8.  
  9. protected $_icon = 'user'; 
  10.  
  11. protected $_templates = 'lastname'; 
  12.  
  13. protected $_test_value = 'Doe'; 
  14.  
  15. public function __construct() 
  16. parent::__construct(); 
  17.  
  18. $this->_nicename = __( 'Last 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_lastname; 
  29.  
  30. return $default_value;