Create new user
@param array $arUserData
@param bool  $bActivate
@return \Lovata\Buddies\Models\User|\RainLab\User\Models\User|null
495683
public function register($arUserData, $bActivate = false)
    {
        if (empty($this->obHelper)) {
            return null;
        }

        $sAuthFacadeClass = $this->obHelper->getAuthFacade();

        return $sAuthFacadeClass::register($arUserData, $bActivate);
    }
827841
protected function createUser(array $userData, $isPortal = false)
    {
        $GLOBALS['log']->info('Creating new user ...');
        $data = array();

        // show full array of the LDAP user
        $GLOBALS['log']->debug('LDAP: user data: ' .print_r($userData, true));

        //set values from ldap server
        $ldapFields = $this->loadFields('ldap');
        foreach ($ldapFields as $espo => $ldap) {
            $ldap = strtolower($ldap);
            if (isset($userData[$ldap][0])) {
                $GLOBALS['log']->debug('LDAP: Create a user wtih ['.$espo.'] = ['.$userData[$ldap][0].'].');
                $data[$espo] = $userData[$ldap][0];
            }
        }

        //set user fields
        if ($isPortal) {
            $userFields = $this->loadFields('portalUser');
            $userFields['type'] = 'portal';
        } else {
            $userFields = $this->loadFields('user');
        }

        foreach ($userFields as $fieldName => $fieldValue) {
            $data[$fieldName] = $fieldValue;
        }

        $this->getAuth()->useNoAuth();

        $user = $this->getEntityManager()->getEntity('User');
        $user->set($data);

        $this->getEntityManager()->saveEntity($user);

        return $this->getEntityManager()->getEntity('User', $user->id);
    }
576727
protected function create(array $data)
    {
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => $data['password'],
            'last_ip' => request()->ip(),
            // Only 'user'.
            'role' => 'user',
        ]);

        return $user;
    }
1147109
public function onSendActivationEmail()
    {
        try {
            if (!$user = $this->user()) {
                throw new ApplicationException(Lang::get(/*You must be logged in first!*/'rainlab.user::lang.account.login_first'));
            }

            if ($user->is_activated) {
                throw new ApplicationException(Lang::get(/*Your account is already activated!*/'rainlab.user::lang.account.already_active'));
            }

            Flash::success(Lang::get(/*An activation email has been sent to your email address.*/'rainlab.user::lang.account.activation_email_sent'));

            $this->sendActivationEmail($user);

        }
        catch (Exception $ex) {
            if (Request::ajax()) throw $ex;
            else Flash::error($ex->getMessage());
        }

        /*
         * Redirect
         */
        if ($redirect = $this->makeRedirection()) {
            return $redirect;
        }
    }
463724
public static function create_from_user(\assign $assign, \stdClass $user) {
        $data = array(
            'context' => $assign->get_context(),
            'objectid' => $assign->get_instance()->id,
            'relateduserid' => $user->id,
        );
        self::$preventcreatecall = false;
        /** @var submission_unlocked $event */
        $event = self::create($data);
        self::$preventcreatecall = true;
        $event->set_assign($assign);
        $event->add_record_snapshot('user', $user);
        return $event;
    }
591131
public function create(User $user = null, $type, \DateTime $expiration = null, $data = null)
    {
        $this->removeExpiredTokens();

        $n = 0;
        do {
            if ($n++ > 1024) {
                throw new \RuntimeException('Unable to create a token.');
            }
            $value = $this->random->generateString(32, self::LETTERS_AND_NUMBERS);
            $found = null !== $this->om->getRepository('Phraseanet:Token')->find($value);
        } while ($found);

        $token = new Token();

        $token->setUser($user)
            ->setType($type)
            ->setValue($value)
            ->setExpiration($expiration)
            ->setData($data);

        $this->om->persist($token);
        $this->om->flush();

        return $token;
    }
600357
public function createPayPalUser($payPalData)
    {
        $userData = $this->prepareDataPayPalUser($payPalData);

        $userId = $this->getIdByUserName($payPalData->getEmail());
        if ($userId) {
            $this->load($userId);
        }

        $this->oxuser__oxactive = new \OxidEsales\Eshop\Core\Field(1);
        $this->oxuser__oxusername = new \OxidEsales\Eshop\Core\Field($payPalData->getEmail());
        $this->oxuser__oxfname = new \OxidEsales\Eshop\Core\Field($userData['oxfname']);
        $this->oxuser__oxlname = new \OxidEsales\Eshop\Core\Field($userData['oxlname']);
        $this->oxuser__oxfon = new \OxidEsales\Eshop\Core\Field($userData['oxfon']);
        $this->oxuser__oxsal = new \OxidEsales\Eshop\Core\Field($userData['oxsal']);
        $this->oxuser__oxcompany = new \OxidEsales\Eshop\Core\Field($userData['oxcompany']);
        $this->oxuser__oxstreet = new \OxidEsales\Eshop\Core\Field($userData['oxstreet']);
        $this->oxuser__oxstreetnr = new \OxidEsales\Eshop\Core\Field($userData['oxstreetnr']);
        $this->oxuser__oxcity = new \OxidEsales\Eshop\Core\Field($userData['oxcity']);
        $this->oxuser__oxzip = new \OxidEsales\Eshop\Core\Field($userData['oxzip']);
        $this->oxuser__oxcountryid = new \OxidEsales\Eshop\Core\Field($userData['oxcountryid']);
        $this->oxuser__oxstateid = new \OxidEsales\Eshop\Core\Field($userData['oxstateid']);
        $this->oxuser__oxaddinfo = new \OxidEsales\Eshop\Core\Field($userData['oxaddinfo']);
        $this->oxuser__oxpassword = new \OxidEsales\Eshop\Core\Field('');
        $this->oxuser__oxbirthdate = new \OxidEsales\Eshop\Core\Field('');

        if ($this->save()) {
            $this->_setAutoGroups($this->oxuser__oxcountryid->value);

            // and adding to group "oxidnotyetordered"
            $this->addToGroup("oxidnotyetordered");
        }
    }
912229
public function create()
    {
        /**
         * @var AdminUserInterface $adminUser
         */
        $classNamespace = $this->getEntityNamespace();
        $adminUser = new $classNamespace();
        $adminUser
            ->setGender(ElcodiUserProperties::GENDER_UNKNOWN)
            ->setToken($this->generator->generate(2))
            ->setEnabled(true)
            ->setCreatedAt($this->now());

        return $adminUser;
    }
401174
private function createUserByOAuthUserResponse(UserResponseInterface $response): WebUserInterface
    {
        /** @var WebUserInterface $user */
        $user = $this->userFactory->createNew();

        if (!$canonicalEmail = $this->canonicalizer->canonicalize($response->getEmail())) {
            throw new AuthorizationException('phpmob.ui.oauth_response_not_found_email');
        }

        $user->setEmailCanonical($canonicalEmail);

        if ($firstName = $response->getFirstName()) {
            $user->setFirstName($firstName);
        }

        if ($lastName = $response->getLastName()) {
            $user->setLastName($lastName);
        }

        if ($displayName = $response->getRealName()) {
            $user->setDisplayName($displayName);
        }

        // set random password to prevent issue with not nullable field & potential security hole
        $user->setPlainPassword(substr(sha1($response->getAccessToken()), 0, 10));
        $user->setEnabled(true);

        return $this->updateUserByOAuthUserResponse($user, $response);
    }
869588
protected function create(array $data)
  {
    //Ceate User
    $user = User::create([
      'name' => $data['name'],
      'email' => $data['email'],
      'password' => bcrypt($data['password']),
    ]);

    //create Blank profile
    $profile = Profile::create([
      'user_id' => $user->id,
      'bio'     => '',
    ]);
    $profile->save();

    //Assign User Role
    $user->assign('user');
    return $user;
  }
406948
public function create(array $credentials, $activate = false)
    {
        $user = $this->storeUser($credentials,$activate);
        $this->event->fire('users.create',array($user));

        return $user;
    }
1209129
public function createUser($data)
    {
        return DB::transaction(function() use ($data) {
            $user = User::create([
                'name' => $data['name'],
                'email' => $data['email'],
                'password' => bcrypt($data['password']),
            ]);

            return $this->service->create($user, $data['password']);
        });
    }
782412
public function login( UserData $user ) {
		// clear session
		foreach ( $_SESSION as $key => $value ) {
			unset( $_SESSION[$key] );
		}

		// generate new session id
		session_regenerate_id( true );

		// store user info in session
		$this->setUser( $user );
	}
145482
protected function setDataUsers(array &$aData, bool $bSetCreated = true): Base
    {
        if ($this->isAutoSetUsers()) {
            if (isLoggedIn()) {
                if ($bSetCreated && empty($aData[$this->tableCreatedByColumn])) {
                    $aData[$this->tableCreatedByColumn] = activeUser('id');
                }
                if (empty($aData[$this->tableModifiedByColumn])) {
                    $aData[$this->tableModifiedByColumn] = activeUser('id');
                }
            } else {
                if ($bSetCreated && empty($aData[$this->tableCreatedByColumn])) {
                    $aData[$this->tableCreatedByColumn] = null;
                }
                if (empty($aData[$this->tableModifiedByColumn])) {
                    $aData[$this->tableModifiedByColumn] = null;
                }
            }
        }

        return $this;
    }
836465
public function createOxidUser($oUserData)
    {
        $aFullName = explode(' ', trim($oUserData->name));
        $sLastName = array_pop($aFullName);
        $sFirstName = implode(' ', $aFullName);

        /** @var oxUser $oUser */
        $oUser = $this->getObjectFactory()->createOxidObject('oxUser');
        $oUser->assign(array(
            'oxregister' => 0,
            'oxshopid' => $this->getConfig()->getShopId(),
            'oxactive' => 1,
            'oxusername' => $oUserData->email,
            'oxfname' => $this->getAddressUtil()->encodeString($sFirstName),
            'oxlname' => $this->getAddressUtil()->encodeString($sLastName),
            'bestitamazonid' => $oUserData->user_id
        ));

        //Set user random password just to have it
        $sNewPass = substr(md5(time() . rand(0, 5000)), 0, 8);
        $oUser->setPassword($sNewPass);

        //Save all user data
        $blSuccess = $oUser->save();

        //Add user to two default OXID groups
        $oUser->addToGroup('oxidnewcustomer');
        $oUser->addToGroup('oxidnotyetordered');

        return $blSuccess;
    }
898346
function factory(array $data, bool $userFetched = false) {
        if(parent::has($data['id'])) {
            $user = parent::get($data['id']);
            $user->_patch($data);
            return $user;
        }
        
        $user = new \CharlotteDunois\Yasmin\Models\User($this->client, $data, false, $userFetched);
        $this->set($user->id, $user);
        
        return $user;
    }
1074076
public function register(array $credentials, $activate = false)
	{
		$user = $this->userProvider->create($credentials);

		if ($activate)
		{
			$user->attemptActivation($user->getActivationCode());
		}

		return $this->user = $user;
	}