source/Application/Model/User.php
public function exists($sOXID = null)
    {
        if (!$sOXID) {
            $sOXID = $this->getId();
        }
        //#5901 if physical record exists return true unconditionally
        if (parent::exists($sOXID)) {
            $this->setId($sOXID);
            return true;
        }

        //additional username check
        //This part is used by not yet saved user object, to detect the case when such username exists in db.
        //Basically it is called when anonymous visitor enters existing username for newsletter subscription
        //see Newsletter::send()
        //TODO: transfer this validation to newsletter part
        $sShopSelect = '';
        if (!$this->_blMallUsers && $this->oxuser__oxrights->value != 'malladmin') {
            $sShopSelect = ' AND oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" ';
        }

        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $sSelect = 'SELECT oxid FROM ' . $this->getViewName() . '
                    WHERE ( oxusername = ' . $masterDb->quote($this->oxuser__oxusername->value) . ' ) ';
        $sSelect .= $sShopSelect;

        if (($sOxid = $masterDb->getOne($sSelect))) {
            // update - set oxid
            $this->setId($sOxid);

            return true;
        }

        return false;
    }
public function exists($sOXID = null)
    {
        if (!$sOXID) {
            $sOXID = $this->getId();
        }
        //#5901 if physical record exists return true unconditionally
        if (parent::exists($sOXID)) {
            $this->setId($sOXID);
            return true;
        }

        //additional username check
        //This part is used by not yet saved user object, to detect the case when such username exists in db.
        //Basically it is called when anonymous visitor enters existing username for newsletter subscription
        //see Newsletter::send()
        //TODO: transfer this validation to newsletter part
        $sShopSelect = '';
        if (!$this->_blMallUsers && $this->oxuser__oxrights->value != 'malladmin') {
            $sShopSelect = ' AND oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" ';
        }

        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $sSelect = 'SELECT oxid FROM ' . $this->getViewName() . '
                    WHERE ( oxusername = ' . $masterDb->quote($this->oxuser__oxusername->value) . ' ) ';
        $sSelect .= $sShopSelect;

        if (($sOxid = $masterDb->getOne($sSelect))) {
            // update - set oxid
            $this->setId($sOxid);

            return true;
        }

        return false;
    }
public function exists ( $ sOXID = null ) { if ( ! $ sOXID ) { $ sOXID = $ this -> getId ( ) ; } //#5901 if physical record exists return true unconditionally if ( parent :: exists ( $ sOXID ) ) { $ this -> setId ( $ sOXID ) ; return true ; } //additional username check //This part is used by not yet saved user object, to detect the case when such username exists in db. //Basically it is called when anonymous visitor enters existing username for newsletter subscription //see Newsletter::send() //TODO: transfer this validation to newsletter part $ sShopSelect = '' ; if ( ! $ this -> _blMallUsers && $ this -> oxuser__oxrights -> value != 'malladmin' ) { $ sShopSelect = ' AND oxshopid = "' . \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) . '" ' ; } // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; $ sSelect = 'SELECT oxid FROM ' . $ this -> getViewName ( ) . '
                    WHERE ( oxusername = ' . $ masterDb -> quote ( $ this -> oxuser__oxusername -> value ) . ' ) ' ; $ sSelect .= $ sShopSelect ; if ( ( $ sOxid = $ masterDb -> getOne ( $ sSelect ) ) ) { // update - set oxid $ this -> setId ( $ sOxid ) ; return true ; } return false ; }
Checks if user exists in database.

@param string $sOXID object ID (default null)

@return bool
Checks if user exists in database .