source/Application/Model/User.php
public function addToGroup($sGroupID)
    {
        if (!$this->inGroup($sGroupID)) {
            // create oxgroup object
            $oGroup = oxNew(\OxidEsales\Eshop\Application\Model\Groups::class);
            if ($oGroup->load($sGroupID)) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Application\Model\Object2Group::class);
                $oNewGroup->oxobject2group__oxobjectid = new \OxidEsales\Eshop\Core\Field($this->getId(), \OxidEsales\Eshop\Core\Field::T_RAW);
                $oNewGroup->oxobject2group__oxgroupsid = new \OxidEsales\Eshop\Core\Field($sGroupID, \OxidEsales\Eshop\Core\Field::T_RAW);
                if ($oNewGroup->save()) {
                    $this->_oGroups[$sGroupID] = $oGroup;

                    return true;
                }
            }
        }

        return false;
    }
public function addToGroup($sGroupID)
    {
        if (!$this->inGroup($sGroupID)) {
            // create oxgroup object
            $oGroup = oxNew(\OxidEsales\Eshop\Application\Model\Groups::class);
            if ($oGroup->load($sGroupID)) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Application\Model\Object2Group::class);
                $oNewGroup->oxobject2group__oxobjectid = new \OxidEsales\Eshop\Core\Field($this->getId(), \OxidEsales\Eshop\Core\Field::T_RAW);
                $oNewGroup->oxobject2group__oxgroupsid = new \OxidEsales\Eshop\Core\Field($sGroupID, \OxidEsales\Eshop\Core\Field::T_RAW);
                if ($oNewGroup->save()) {
                    $this->_oGroups[$sGroupID] = $oGroup;

                    return true;
                }
            }
        }

        return false;
    }
public function addToGroup ( $ sGroupID ) { if ( ! $ this -> inGroup ( $ sGroupID ) ) { // create oxgroup object $ oGroup = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Groups :: class ) ; if ( $ oGroup -> load ( $ sGroupID ) ) { $ oNewGroup = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Object2Group :: class ) ; $ oNewGroup -> oxobject2group__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> getId ( ) , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ oNewGroup -> oxobject2group__oxgroupsid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sGroupID , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; if ( $ oNewGroup -> save ( ) ) { $ this -> _oGroups [ $ sGroupID ] = $ oGroup ; return true ; } } } return false ; }
Adds user to the group

@param string $sGroupID group id

@return bool
Adds user to the group