Occasionally, customers delete their account by mistake. The account can be deleted independently in the dashboard of each customer account. This ensures that legal requirements are met. But what if the account has been deleted by mistake and you don’t want to lose your bookings? Restoring a backup rarely makes sense. In the following guide, we offer an alternative solution:
Create a new customer account
As a first step, have your customer create a new account. The account can contain the same email address and password as before.
Alternatively, you can create a new user via the WordPress backend.
Once the new account has been created, you can view it via the backend. Navigate to the new user account and note the user’s user_id
from the URL.
Find old bookings and assign them to a new account
In order to find the bookings via the old account, you can search for them in the database. Therefore, log in to the database via your hosting (for example via phpMyAdmin). Once you’re here, you can search for bookings that aren’t currently assigned to a user account as follows:
SELECT * FROM `wp_cbs_bookings` WHERE user_id NOT IN (SELECT ID FROM `wp_users`);
Note: The prefix wp_ may differ in some cases.
You should now receive one or more entries of bookings with a user_id
, for example 79.
Now update all entries with the old user_id
2 (see screenshot above) with the new user_id
79 as follows:
UPDATE `wp_cbs_bookings` SET `user_id` = 79 WHERE `user_id` = 2;
UPDATE `wp_cbs_logs` SET `user_id` = 79 WHERE `user_id` = 2;
Note: The database prefix wp_ can also differ here.