Suspending a User with a Shop - FIXED IN V3.3

Post Reply
RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Suspending a User with a Shop - FIXED IN V3.3

Post by RWAP » Tue May 28, 2013 3:54 pm

If a user has a shop and is suspended through the admin backend, their shop will still appear in the list of shops (although there will be no items listed).

To overcome this, in class\User.php

Find:

Code: Select all

    public function suspend(MyPDO $DB)
    {
        $return = true;
        $bids = Bid::getListFromDB($DB, " where offers.active=1 and bids.userId='".$this->id."'");
        if($bids){
            foreach($bids as $bid){
                $offer = Offer::getInstanceFromDB($DB, $bid['offerId']);
                $return&= $offer->removeUserBids($DB,$this);
                unset($offer);
            }
        }
        $offers = Offer::getFastListFromDB($DB, " where offers.active=1 and items.userId='".$this->id."'");
        if($offers){
            foreach($offers as $v){
                $return&=Offer::activate($DB,0,$v['id']);
            }
        }
Add below this:

Code: Select all

		// Disable any store by setting status to inactive
		$store = Store::getUserStore($DB,$this);
		if ($store){
			$store->active = 0;
			$store->saveToDB($DB);
		}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest