/** * Create record in USERS collection * * @return object $this * */ protected function createNewUser() { $tzo = Cookie::get('tzo', 0); $username = $this->makeUsername($this->aGfcData['displayName']); /** * Create new record in USERS collection * do this first because we need uid from * newly created record * */ $aUser = array('fn' => $this->aGfcData['displayName'], 'avatar_external' => $this->aGfcData['thumbnailUrl'], 'i_reg_ts' => time(), 'date_reg' => date('r'), 'username' => $username, 'username_lc' => \mb_strtolower($username), 'role' => 'external_auth', 'lang' => $this->Registry->getCurrentLang(), 'locale' => $this->Registry->Locale->getLocale(), 'fcauth' => $this->fcauth, 'tz' => TimeZone::getTZbyoffset($tzo), 'i_pp' => 1, 'i_fv' => false !== ($intFv = Cookie::getSidCookie(true)) ? $intFv : time()); $aUser = array_merge($this->Registry->Geo->Location->data, $aUser); d('aUser: '******'s a newsly registered user * and ask the user to provide email address but only * during the same session * * @todo this does not really work right now * because newUser field is not included in serialization * of user object, thus it's not saved * when session is serialized * This may change if serialize()/unserialize() methods are * modified in User class */ $this->User->setNewUser(); $this->User->save(); $this->Registry->Dispatcher->post($this->User, 'onNewUser'); $this->Registry->Dispatcher->post($this->User, 'onNewGfcUser'); /** * Create new record in USERS_GFC */ $this->updateGfcUserRecord(); PostRegistration::createReferrerRecord($this->Registry, $this->User); return $this; }