Guest User

Untitled

a guest
Jan 23rd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2.  
  3. public function create_account()
  4. {
  5. $this->values($_POST, array(
  6. 'first_name',
  7. 'last_name',
  8. 'mobile'
  9. ));
  10.  
  11. $this->user->values($_POST, array(
  12. 'email',
  13. 'username',
  14. 'password'
  15. ));
  16.  
  17. $extra_validation = Model_User::get_password_validation($_POST)
  18. ->rule('password', 'not_empty');
  19.  
  20. $landlord_validation = $this->validation();
  21. $user_validation = $this->user->validation();
  22.  
  23. $user_check = $user_validation->check($extra_validation);
  24. $landlord_check = $landlord_validation->check();
  25.  
  26. if ( ! $user_check OR ! $landlord_check)
  27. {
  28. $e = new ORM_Validation_Exception($this->_object_name, $landlord_validation);
  29. $e->add_object($this->user->_object_name, $user_validation);
  30.  
  31. throw $e;
  32. }
  33.  
  34. // Avoid validating twice
  35. $this->_valid = $this->user->_valid = TRUE;
  36.  
  37. $this->user->save();
  38.  
  39. $this->user_id = $this->user->id;
  40. $this->save();
  41.  
  42. return $this;
  43. }
Add Comment
Please, Sign In to add comment