Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
86 views
in Q2A Core by
edited by

I hide all duplicate questions:

UPDATE `qa_posts`JOIN ( SELECT title, MIN(postid) minID FROM `qa_posts` GROUP BY title HAVING COUNT(*) > 1) t2 ON qa_posts.title = t2.title AND qa_posts.postid != t2.minID SET qa_posts.type = "Q_HIDDEN";

But i can't delete it, because they have answers...

How to delete all Answers from all Hidden Questions ?

Q2A version: 1.8.3

1 Answer

+1 vote
by
selected by
 
Best answer

Deleting all answers from all hidden questions is something that will have to be performed by directly manipulating data in the database.

However, the workaround for being able to delete questions with children (answers or comments) is using this plugin: https://github.com/amiyasahu/q2a-delete-hidden-posts which will allow you to delete a question and their children (one by one, not all at once).

by
Thanks a lot
by
edited by
(delete alert) in file qa-dhp-admin.php

i change this

'tags'  => 'NAME="' . self::DELETE_HIDDEN_POSTS_BTN . '" onclick="dhp_ask_user_confirmation(event) && qa_show_waiting_after(this, false);"',

to this

'tags'  => 'NAME="' . self::DELETE_HIDDEN_POSTS_BTN . '" onclick="qa_show_waiting_after(this, false);"',

and in brower console on plugin page create autoclick javascript:

setInterval(function () {document.getElementsByName("ami_dhp_delete_button")[0].click();}, 40000);
by
what am I doing wrong ? (the script works only  once)
by
Temporary solution:

document.getElementsByName("ami_dhp_delete_button")[0].click();
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },20000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },30000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },40000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },50000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },60000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },70000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },80000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },90000);
setInterval(function(){
 document.getElementsByName("ami_dhp_delete_button")[0].click();
 },100000);
...