Пример #1
0
 /**
  * Create missed LiteCommerce accounts 
  * 
  * @return void
  */
 protected function createMissedLCAccounts()
 {
     foreach ($this->drupalAccounts as $k => $account) {
         if ($this->checkUserAccountsPerStepCounter()) {
             $profile = new \XLite\Model\Profile();
             $profile->setLogin($account->mail);
             $profile->setCmsProfileId($account->uid);
             $profile->setCmsName(\XLite\Module\CDev\DrupalConnector\Handler::getInstance()->getCMSName());
             $profile->setStatus(1 === intval($account->status) ? 'E' : 'D');
             $pass = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->generatePassword();
             $profile->setPassword(md5($pass));
             $user = user_load($account->uid);
             if (user_access(\XLite\Module\CDev\DrupalConnector\Drupal\Profile::LC_DRUPAL_ADMIN_ROLE_NAME, $user)) {
                 $profile->setAccessLevel(\XLite\Core\Auth::getInstance()->getAdminAccessLevel());
             }
             $profile->create();
             unset($this->drupalAccounts[$k]);
         } else {
             break;
         }
     }
 }