/** * Create new record in the USERS collection * also set the $this->User to the newly created * instance of UserLinkedin object * * */ protected function createNewUser() { d('$this->aData: ' . print_r($this->aData, 1)); $ln = !empty($this->aData['ln']) ? $this->aData['ln'] : ''; $oEA = \Lampcms\ExternalAuth::factory($this->Registry); $u = $this->aData['fn'] . '_' . $ln; d('$u: ' . $u); $username = $oEA->makeUsername($u); $sid = \Lampcms\Cookie::getSidCookie(); d('sid is: ' . $sid); $this->aData['username'] = $username; $this->aData['username_lc'] = \mb_strtolower($username, 'utf-8'); $this->aData['i_reg_ts'] = time(); $this->aData['date_reg'] = date('r'); $this->aData['role'] = 'external_auth'; $this->aData['rs'] = false !== $sid ? $sid : \Lampcms\String::makeSid(); $this->aData['i_rep'] = 1; $this->aData['lang'] = $this->Registry->getCurrentLang(); $this->aData['locale'] = $this->Registry->Locale->getLocale(); if (empty($this->aData['cc']) && empty($this->aData['city'])) { $this->aData = array_merge($this->Registry->Geo->Location->data, $this->aData); } $this->User = \Lampcms\UserLinkedin::factory($this->Registry, $this->aData); /** * This will mark this userobject is new user * and will be persistent for the duration of this session ONLY * This way we can know it's a newsly registered user * and ask the user to provide email address but only * during the same session */ $this->User->setNewUser(); d('isNewUser: '******'onNewUser'); return $this; }