Deleting users from the OJS database


Hi @Keir_Vaughan_taylor,

Is it possible that the JM used the “Remove” feature, not the “Merge” feature? Remove just clears all roles from the user’s account, but does not delete the account. “Merge” will actually delete the user.

Alec Smecher
Public Knowledge Project Team


So if I have a journal manager who has removed the account when they should have merged it, what do I do to clean up the problem? Thanks for your help.


If a role has been removed from a user, you can always re-add the role at a later time. User Home -> Journal Manager -> Enroll a User from this Site in this Journal.

This will allow the account to show in the Merge Users function again.


Perfect! Thanks for your help.


Hi there,
what would be the way to re-create a user in OJS3. There I couldn’t find the Enroll a User


Found a way. I accidentally deleted the user. So, I added an entry in user_user_groups. This way the users pane would show the user again and I could merge it to re-create the account.


Dear Asmecher,
we have thousands of spam accounts. I cannot merge one by one.
Would you please let me know how can I delete all the unrolled and/or spam accounts from our system?
We have OJS 3.0.0

I’ve read in How do I remove users for good? that exists a command to delete/merge a group of authors. It could be useful. Which command is it?

And finally, how can I insert a captcha or recaptcha anti-spam in our register process?

Thank you so much.


Hi @Isabel-M,

The command-line tool to merge users is tools/mergeUsers.php; to enable ReCAPTCHA testing, see your configuration file.

Alec Smecher
Public Knowledge Project Team


Instructions on using Merge Please either tool or Site Administration -> Merge Users.

DO you find a BAD user? Go to Merge Users click on them find another BAD user and merge,
You are back at screen 1.

Find that second BAD (SPAMMED USER) in Merge Users by search on user name click to merge them and select a 3rd BAD user.

WE have 6,000 or so BAD users. There are 2 Searches per “merge to get rid of the first”

WE actually seem tohave 908 Users with username starts with

What about that tool?

Do you have to use https://JournalURL/base/tools/mergeUsers.php to find it because there is no menus option to run it?

Is it a different .php code to what you get at Site Adminstration -> Merge Users?

WE have 908 users with username starts with “carpinteyr” I takes a lot of time to just merge 10 of them out.

There needs to be in Enrolled users or Merge Users a Tick a lot of users and use a Remove or Delete option that gets them out. that would not be difficult for developers who know what tables they are in and can write sql to delete from all tables by username.


Hi @ais681,

The mergeUsers.php tool is intended for command-line use, not via the web server. If you have command-line access, it’s a much faster way to remove accounts.

Alec Smecher
Public Knowledge Project Team

Wie kann man BenutzerInnen löschen/entfernen (FAQ, OJS 2.4.8)

What is the syntax?
You would still have to collect together all the BAD userNames or some Idetifier or is it intelligent so it can get all with BAD email addresses or name fields that do not contain names?

IT says it is a tool for merging 2 accounts so how does it help with removing thousands of spammed ones.?

Why is it better than System Administrations -> Merge Users?



Hi @ais681,

You can get the syntax by running the tool:

 $ php tools/mergeUsers.php 
OJS merge users tool
Use this tool to merge two OJS user accounts.

Usage: tools/mergeUsers.php [username1] [username2]
username1      The first user to merge.
username2      The second user to merge. All roles and content associated
               with this user account will be transferred to the user account
               that corresponds to username1. The user account that corresponds
               to username2 will be deleted.

It’s better for mass account removal than the web-based approach because it’s easier to automate.

Alec Smecher
Public Knowledge Project Team



I did get it to work and it is the only way to remove people from the DB when Journal Admins have removed all their roles thinking the remove button removes them as users in the journal.

So I said sorry.
You need to add a role back then get rid of them 1 by one by merge.

Problem is they have thousands of spam added users so it would be good if there was a one screen select a lot press one button interface.

If you send me a list I can get lots in a script.



Excuse me @henkel,
please can you tell me where I can find the


I’ve got the same problem in OJS 3.0.2.


Thank you! it helped out


I also have hundreds of spam users, although using reCaptcha (I use OJS Neither Merge Users nor command-line approaches seem to be handy. Either way, you need to choose or enter hundreds of usernames. I just wanted to remove all users who didn’t validate their accounts directly from database. Anyone has tried it and encountered any problems?

I tested removing disabled users from users table, but the entries in dependent tables were not deleted, i.e., in tables: user_settings, user_interests, roles. Any other tables to include? This could help to remove those users.


how to delete users without role using SQL Query? I need to delete all spam users from the past.


Hi @andrewdion04,

Have a look at the command-line tool tools/mergeUsers.php.

Alec Smecher
Public Knowledge Project Team


Hi @asmecher,

may i ask why there has never been an option to delete a user completely? I mean, I have never seen an application where you have to “merge into an existing user” to get rid of another one which brings the next question to the table: what do I do with the merged user then? I simply registered a user in a live environment to test something in expectation that I can remove the user later easily via admin … but to no avail. I’m a bit shocked frankly speaking.

So lonG


Hi @j1shin,

If you want to get rid of a test account, merge it into your administrator account. The distinction between “merge” and “delete” is that the merged account’s submissions etc. are preserved.

Alec Smecher
Public Knowledge Project Team