public function signUp() : Users
    {
        $this->sex = 'U';

        if (empty($this->firstname)) {
            $this->firstname = ' ';
        }

        if (empty($this->lastname)) {
            $this->lastname = ' ';
        }

        $this->displayname = empty($this->displayname) && !empty($this->firstname) ? $this->generateDisplayName($this->firstname) : $this->displayname;
        $this->dob = date('Y-m-d');
        $this->lastvisit = date('Y-m-d H:i:s');
        $this->registered = date('Y-m-d H:i:s');
        $this->timezone = 'America/New_York';
        $this->user_level = 3;
        $this->user_active = 1;
        $this->status = 1;
        $this->banned = 'N';
        $this->profile_header = ' ';
        $this->user_login_tries = 0;
        $this->user_last_login_try = 0;

        //if the user didnt specify a default company
        if (empty($this->default_company)) {
            $this->default_company = 0;
        }
        $this->session_time = time();
        $this->session_page = time();
        $this->password = self::passwordHash($this->password);

        if (empty($this->language)) {
            $this->language = $this->usingSpanish() ? 'ES' : 'EN';
        }

        $this->user_activation_key = $this->generateActivationKey();

        if (!$this->save()) {
            throw new Exception(current($this->getMessages()));
        }

        return $this;
    }
public function signUp() : Users
    {
        $this->sex = 'U';

        if (empty($this->firstname)) {
            $this->firstname = ' ';
        }

        if (empty($this->lastname)) {
            $this->lastname = ' ';
        }

        $this->displayname = empty($this->displayname) && !empty($this->firstname) ? $this->generateDisplayName($this->firstname) : $this->displayname;
        $this->dob = date('Y-m-d');
        $this->lastvisit = date('Y-m-d H:i:s');
        $this->registered = date('Y-m-d H:i:s');
        $this->timezone = 'America/New_York';
        $this->user_level = 3;
        $this->user_active = 1;
        $this->status = 1;
        $this->banned = 'N';
        $this->profile_header = ' ';
        $this->user_login_tries = 0;
        $this->user_last_login_try = 0;

        //if the user didnt specify a default company
        if (empty($this->default_company)) {
            $this->default_company = 0;
        }
        $this->session_time = time();
        $this->session_page = time();
        $this->password = self::passwordHash($this->password);

        if (empty($this->language)) {
            $this->language = $this->usingSpanish() ? 'ES' : 'EN';
        }

        $this->user_activation_key = $this->generateActivationKey();

        if (!$this->save()) {
            throw new Exception(current($this->getMessages()));
        }

        return $this;
    }
public function signUp ( ) : Users { $ this -> sex = 'U' ; if ( empty ( $ this -> firstname ) ) { $ this -> firstname = ' ' ; } if ( empty ( $ this -> lastname ) ) { $ this -> lastname = ' ' ; } $ this -> displayname = empty ( $ this -> displayname ) && ! empty ( $ this -> firstname ) ? $ this -> generateDisplayName ( $ this -> firstname ) : $ this -> displayname ; $ this -> dob = date ( 'Y-m-d' ) ; $ this -> lastvisit = date ( 'Y-m-d H:i:s' ) ; $ this -> registered = date ( 'Y-m-d H:i:s' ) ; $ this -> timezone = 'America/New_York' ; $ this -> user_level = 3 ; $ this -> user_active = 1 ; $ this -> status = 1 ; $ this -> banned = 'N' ; $ this -> profile_header = ' ' ; $ this -> user_login_tries = 0 ; $ this -> user_last_login_try = 0 ; //if the user didnt specify a default company if ( empty ( $ this -> default_company ) ) { $ this -> default_company = 0 ; } $ this -> session_time = time ( ) ; $ this -> session_page = time ( ) ; $ this -> password = self :: passwordHash ( $ this -> password ) ; if ( empty ( $ this -> language ) ) { $ this -> language = $ this -> usingSpanish ( ) ? 'ES' : 'EN' ; } $ this -> user_activation_key = $ this -> generateActivationKey ( ) ; if ( ! $ this -> save ( ) ) { throw new Exception ( current ( $ this -> getMessages ( ) ) ) ; } return $ this ; }
user signup to the service

@return Users
user signup to the service