UserModel::reduceInviteCount PHP Method

reduceInviteCount() public method

Reduces the user's CountInvitations value by the specified amount.
public reduceInviteCount ( integer $UserID, integer $ReduceBy = 1 )
$UserID integer The unique id of the user being affected.
$ReduceBy integer The number to reduce CountInvitations by.
    public function reduceInviteCount($UserID, $ReduceBy = 1)
    {
        $CurrentCount = $this->getInvitationCount($UserID);
        // Do not reduce if the user has unlimited invitations
        if ($CurrentCount == -1) {
            return true;
        }
        // Do not reduce the count below zero.
        if ($ReduceBy > $CurrentCount) {
            $ReduceBy = $CurrentCount;
        }
        $this->SQL->update($this->Name)->set('CountInvitations', 'CountInvitations - ' . $ReduceBy, false)->where('UserID', $UserID)->put();
    }
UserModel