0 like 0 dislike
7 views
asked in Software by (4.5k points)
edited by

On site did registered many count of bots. How to mass delete users in question2answer CMS?

question2answer cms mass user delete
q2a cms delete inactive users

Your answer

pre, code

Preview

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

0 like 0 dislike
answered by (4.5k points)
edited by

Standard ways no way. Question2answer CMS don't support mass user delete (deleting of bad inactive users). For administrator available only single user deleting. But, you can mass delete users in DB if run SQL queries.

In very easy case this looks so like this:

DELETE FROM `qa_users` WHERE `userid` != 1;
DELETE FROM `qa_userpoints` WHERE `userid` != 1;

But information about users are stored and in other db tables, it need delete too.

Total, you need delete information about bad users from tables where is a field userid, it next tables:

  • qa_blobs
  • qa_messages
  • qa_userevents
  • qa_userfavorites
  • qa_userlevels
  • qa_userlimits
  • qa_userlogins
  • qa_usermetas
  • qa_usernotices
  • qa_userpoints
  • qa_userprofile
  • qa_users
  • qa_uservotes

For Question2Answer CMS version 1.7.5 with Q2A DB version 59 and for Question2Answer version 1.8.0 with Q2A database version 67 in DBMS run next SQL statements:

delete from qa_blobs where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userevents where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userfavorites where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userlevels where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userlimits where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userlogins where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_usermetas where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_usernotices where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userpoints where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_userprofile where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_users where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_uservotes where userid not in (select distinct userid from qa_posts where userid is not null);
delete from qa_messages where fromuserid not in (select distinct userid from qa_posts where userid is not null);

Now go to Admin > Stats and press the "Delete Hidden Posts" button, this will delete all questions, answers, comments from the user. Now recount and recalculate all stuffs to take affect everything in the system.

Related questions

0 like 0 dislike
1 answer 11 views
0 like 0 dislike
1 answer 9 views
0 like 0 dislike
1 answer 9 views
0 like 0 dislike
1 answer 1 view
0 like 0 dislike
1 answer 24 views
0 like 0 dislike
1 answer 24 views
0 like 0 dislike
1 answer 10 views
0 like 0 dislike
1 answer 1 view
0 like 0 dislike
1 answer 5 views
...