How to delete not active users/reviewer last 4 years

Hello Team
We have upgraded OJS 2.4 to OJS 3.3.0.10 and we have more than 18 lakh users. We want to delete not active users and reviewers who have last login 4 years ago.

Kindly suggest me MySQL query or other methods to do the above mentioned.

Hello @shantanusingh ,

Maybe this can help you:

https://docs.pkp.sfu.ca/admin-guide/en/securing-your-system#cleaning-lots-of-users

In this process we are not able to identify the user last login date and which user to merge with. And if we have 50K users then how will we identify the user for merge.

You need to go to the database, users table, there is a column called date_last_login.
But you must be careful, because there may be real users who have not entered the journal for a long time.

Ok,
If we want only remove reviewer role who have last login 4 year ago.
Like this Query ?
select users., user_user_groups., user_groups.* from users, user_user_groups, user_groups where year(users.date_last_login) <= 2015 AND users.user_id = user_user_groups.user_id AND user_groups.role_id = 4096;

can we go with this query ?

It is not recommended to delete them in this way, since there are more tables involved related to users (preferences, groups, etc). What you can do is create the list of usernames and then use the script I wrote in the previous link to merge all users with an existing OJS account.

The merge process will proceed to delete the user and transfer pending processes or assignments to the user you have selected. This helps you to have a healthier system and not have orphan records.