bymayo/craft-delete-account

[FR] Commerce orders, anonymization

Opened this issue · 4 comments

Have an option to transfer orders from the current user to a pre-defined "dummy" user on account deletion.

Most clients dont want the order to be deleted when a user is deleted, they want to keep the order to keep track of sales etc. Anonymization of the order is prefered to simply deleting it. Replacing the related User on an order would fix this.

Commerce orders shouldn't be deleted when a user is deleted. I haven't added this functionality. Saying this though, setting a 'dummy' user will fix this issue. Not sure how this works regarding GDPR though as customer details are still retained.

Any users with access to the CP cannot be deleted (Unless you turn this option off) so all entries etc created via the CP will still be attached to the user that deleted them :)

Following up from this, I am getting the following error:

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (two-for-joy.craft_commerce_customers, CONSTRAINT craft_commerce_customers_userId_fk FOREIGN KEY (userId) REFERENCES craft_users (id) ON DELETE SET NULL). The SQL statement executed was: INSERT INTO craft_commerce_customers (uid, email, userId, lastUsedBillingAddressId, lastUsedShippingAddressId, dateUpdated, dateCreated) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6). Bound with :yp0='b43a903e-ee28-445a-b593-71390dd772c1', :yp1='email@website.co.uk', :yp2=1683, :yp3=NULL, :yp4=NULL, :yp5='2018-05-08 15:40:02', :yp6='2018-05-08 15:40:02'

@McCrisp I've added a 'Transfer content to' setting in the Craft 2 version (Craft 3 coming tomorrow) to enable you to set a user to transfer any content to once the user is deleted.

@McCrisp WOW, 2018... How time flies.

I've actually implemented this feature now, and will be available shortly.