WYSIJA_model_user_field

The MailPoet Newsletters WYSIJA model user field class.

Defined (1)

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

/models/user_field.php  
  1. class WYSIJA_model_user_field extends WYSIJA_model{ 
  2.  
  3. var $pk="field_id"; 
  4. var $table_name="user_field"; 
  5. var $columns=array( 
  6. 'field_id'=>array("req"=>true, "type"=>"integer"),  
  7. 'name'=>array("req"=>true),  
  8. 'column_name' => array("req"=>true),  
  9. 'type' => array("req"=>true, "type"=>"integer"),  
  10. 'values' => array("req"=>true),  
  11. 'default' => array("req"=>true),  
  12. 'is_required' => array("req"=>true, "type"=>"integer"),  
  13. 'error_message' => array("req"=>true) 
  14. ); 
  15.  
  16. function __construct() { 
  17. $this->defaults=array('email'=>__('Email', WYSIJA),  
  18. 'firstname'=>__('First name', WYSIJA),  
  19. 'lastname'=>__('Last name', WYSIJA),  
  20. 'ip'=>__('IP address', WYSIJA),  
  21. 'status'=>__('Status', WYSIJA),  
  22. 'created_at'=>__('Subscription date', WYSIJA)); 
  23. parent::__construct(); 
  24.  
  25. function getFields() { 
  26. $fields = array(); 
  27.  
  28. // add custom fields 
  29. $WJ_Field = new WJ_Field(); 
  30. $custom_fields = $WJ_Field->get_all(); 
  31. if(!empty($custom_fields)) { 
  32. foreach($custom_fields as $row) { 
  33. $fields['cf_'.$row->id] = $row->name; 
  34.  
  35.  
  36. return array_merge($this->defaults, $fields);