Deleting users and stores

Report issues with Enuuk Auction Platform or Mods here - remember to raise a ticket with phpauction.net as well
Post Reply
bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

Deleting users and stores

Post by bamse » Mon Mar 04, 2013 7:51 pm

Not sure whether this is due to some of my modifications....

If I delete a user in the admin backend, that user's auctions get deleted as well which is fine. However the user's store is not deleted. When afterwards I try to delete the store in the backend, I get an error message: "Please select a valid store."

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

Re: Deleting users and stores

Post by RWAP » Tue Mar 05, 2013 9:56 am

You are correct - this is an issue with class\Action\Admin\User.php

Find:

Code: Select all

            if($userDelete){
                $result = true;

                // Delete other related data of the user
Add below this:

Code: Select all

                // Delete user's store if they have one.
		        $store = Store::getUserStore($this->db,$userDelete);
	            if($store instanceof Store){
	                $result&=$store->deleteFromDB($this->db);
	            }

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

Re: Deleting users and stores

Post by RWAP » Tue Mar 05, 2013 2:16 pm

According to enuuk, there should be a foreign key on the XX_stores table which means when the user is deleted, the store is also:

Check your SQL database - does the table have:

ADD CONSTRAINT `eA_stores_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `eA_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest