Guest User

Untitled

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