Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Deleting multiple Users without any activity

Greetings.

We have been a satellite office from our parent company and an OSTicket user for years. Now our office has been sold to a different company. Our previous owners made us a copy of the database and we have it up and starting to run. I'm in the process of cleaning out anything that was related to the previous owner and want to continue on for the new company. We used departments to segregate the locations.

My issue is trying to delete multiple users who have no activity at all. There are more than 20 pages of these. I see no way to select multiple users. Doing them individually would take me days.

Is there any way to achieve this or is this something that might be available in the future?

Comments

  • Do you define the no activity users as users with no tickets?

    You can try below commands to find them, the below users should have no tickets so verify with the below commands, if they're correct you can remove them using them in this order but replacing SELECT * with DELETE, NOTE that you will not be able to undo these actions without a backup.

    SELECT * FROM `ost_user_email` WHERE `user_id` IN (SELECT `default_email_id` FROM `ost_user` WHERE `id` NOT IN (SELECT DISTINCT `user_id` FROM `ost_ticket`))

    SELECT * FROM `ost_user_account` WHERE `user_id` IN (SELECT `id` FROM `ost_user` WHERE `id` NOT IN (SELECT DISTINCT `user_id` FROM `ost_ticket`))

    SELECT * FROM `ost_user` WHERE `id` NOT IN (SELECT DISTINCT `user_id` FROM `ost_ticket`)
  • "NOTE that you will not be able to undo these actions without a backup."

    So ALWAYS backup your database before running SQL queries manually. :)
Sign In or Register to comment.