Beispiel #1
0
 /**
  * Save anonymous profile
  * FIXME
  *
  * @return void
  */
 protected function saveAnonymousProfile()
 {
     parent::saveAnonymousProfile();
     $pass = user_password();
     $status = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_VISITORS;
     $data = array('name' => \XLite\Core\Session::getInstance()->order_username, 'init' => $this->getCart()->getOrigProfile()->getLogin(), 'mail' => $this->getCart()->getOrigProfile()->getLogin(), 'roles' => array(), 'status' => $status, 'pass' => $pass);
     $account = user_save('', $data);
     if ($account) {
         $account->password = $pass;
         if ($account->status) {
             _user_mail_notify('register_no_approval_required', $account);
         } else {
             _user_mail_notify('register_pending_approval', $account);
         }
         $this->getCart()->getProfile()->setCmsName('');
         $this->getCart()->getProfile()->setCmsProfileId(0);
         $this->getCart()->getOrigProfile()->setPassword(md5($pass));
         \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->linkProfiles($this->getCart()->getOrigProfile(), $account->uid);
     }
     unset(\XLite\Core\Session::getInstance()->order_username);
 }