Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * Create new record in the USERS collection
  * also set the $this->User to the newly created
  * instance of UserLinkedin object
  *
  *
  */
 protected function createNewUser()
 {
     d('creating new user');
     /**
      * Need to call /people/~/email-address to get email address
      * and /people/~ to get data that includes avatar among other things
      */
     if (false !== ($tzn = Cookie::get('tzn'))) {
         $timezone = $tzn;
     } else {
         $timezone = $this->Registry->Ini->SERVER_TIMEZONE;
     }
     $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[Schema::USERNAME] = $username;
     $this->aData[Schema::USERNAME_LOWERCASE] = \mb_strtolower($username, 'utf-8');
     $this->aData[Schema::REGISTRATION_TIMESTAMP] = time();
     $this->aData[Schema::REGISTRATION_TIME] = date('r');
     $this->aData[Schema::ROLE] = Role::EXTERNAL_USER;
     $this->aData[Schema::SID] = false !== $sid ? $sid : \Lampcms\String::makeSid();
     $this->aData[Schema::REPUTATION] = 1;
     $this->aData[Schema::LANG] = $this->Registry->getCurrentLang();
     $this->aData[Schema::LOCALE] = $this->Registry->Locale->getLocale();
     $this->aData[Schema::TIMEZONE] = $timezone;
     if (!empty($this->email)) {
         $this->aData[Schema::EMAIL] = $this->email;
     }
     if (empty($this->aData['cc']) && empty($this->aData['city'])) {
         $this->aData = array_merge($this->Registry->Geo->Location->data, $this->aData);
     }
     $this->User = \Lampcms\UserLinkedin::userFactory($this->Registry, $this->aData);
     /**
      * This will mark this user object is new user
      * and will be persistent for the duration of this session ONLY
      * This way we can know it's a newly registered user
      * and ask the user to provide email address but only
      * during the same session
      */
     $this->User->setNewUser();
     d('isNewUser: '******'onNewUser');
     return $this;
 }