Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
123 views
ago in Plugins by
There is a plugin for it but it does it individually.
Q2A version: 1.8.5

2 Answers

+1 vote
ago by
edited ago by
 
Best answer

The distinction between comment and answer is merely the value of the field type in the database table qa_posts. To convert all comments to answers do this:

UPDATE qa_posts SET type='A' WHERE type='C';

To convert just the comments for a particular question do this (replace 42 with the actual post ID of the question at hand):

UPDATE qa_posts SET type='A' WHERE parentid=42 AND type='C';


Edit: For converting comments on answers you can use a slightly modified version of the query for converting comments on questions that I posted in the comments. Just change the parent type from "Q" to "A".

UPDATE qa_posts c INNER JOIN qa_posts p ON c.parentid = p.postid SET c.type = 'A' WHERE c.type = 'C' AND p.type = 'A';

If you want to convert comments for a particular post add a clause for the parent post ID:

... AND p.type = 'A' AND p.postid = 42;

ago by
@sonsuz That would convert the comments on *questions* to answers. You said you needed to convert the comments on *answers* to answers.
ago by
I said is not same

@fazleysabbir O ye of little faith ... UPDATE qa_posts c INNER JOIN qa_posts q ON c.parentid = q.postid SET c.type = 'A' WHERE c.type = 'C' AND q.type = 'Q';

UPDATE qa_posts c INNER JOIN qa_posts p ON c.parentid = p.postid SET c.type = 'A' WHERE c.type = 'C' AND p.type = 'A';
ago by
do they both work?
ago by
Of course they're not the same. Did you not read what I wrote in my answer? type='Q' is for CONVERTING COMMENTS ON QUESTIONS. type='A' is for CONVERTING COMMENTS ON ANSWERS.

If you want to convert comments on answers rather than questions YOU MUST USE THE LATTER INSTEAD OF THE FORMER.
0 votes
ago by
https://github.com/q2apro/q2apro-comment-to-answer/blob/master/q2apro-comment-to-answer-page.php

It's okay to do it one by one. Is it possible to do all of them?
ago by
maybe it can be done again for all comments in this plugin
...