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

I am intending to remove the best answer button and the last answer due to @pupi1985 is just great: http://www.question2answer.org/qa/44488/how-to-remove-the-best-answer-button-from-every-question-page

Since my Q2A is still in tests there no many questions that were selected best choices.

1) I am thinking about removing one by one or using a database query that transforms all fields selchildid of qa_posts to null (I am considering this answer http://www.question2answer.org/qa/37526/how-are-questions-and-best-answers-for-them-stored-in-db?show=37526#q37526 to assume that this information is only kept in qa_posts.

2) All users that received points because they had answers selected as the best ones will lose points. So my idea is to give them bonus exactly with the lost value. Basically there are four users like this in my database.

3) After doing that I proceed like http://www.question2answer.org/qa/44488/how-to-remove-the-best-answer-button-from-every-question-page

Am I missing something? Do I need to worry about any css files?

 

Q2A version: 1.7.0

1 Answer

+1 vote
by
selected by
 
Best answer

1) Touching the database directly is never good. The results in terms of data might seem to be the same but the truth is that some events are missed. For instance, after removing the values with an SQL query you will not have the points automatically calculated as that is something that PHP does.

The best way to solve step 1 would need to execute PHP code. There are a couple of alternatives but if, as you mentioned, there are a small amount of questions in that state then it might be better to do it manually rather than writing PHP code.

For the sake of completeness, the full approach would involve writing a similar SQL to the one you've linked that would fetch the IDs of all questions with best answers selected and then pass all those IDs through this magic function.

2) You're right. However, you should consider that also users who select the best answers will also have their points affected (unless you've set that setting to 0). Also note that I would perform this step before the previous one or at least making sure you have the tuple: user_who_selected_answer, user_who_got_answer_selected and post_id. That way you can later figure out how points will be affected and perform the corresponding update later (maybe an Excel file would help, depending on the amount of users and questions)

3) That's perfectly fine

This is a core hack so there isn't much testing on this. So I can't be 100% sure you won't need an additional change in the future, including CSS. However, at first sight, you shouldn't as what you are changing (the commented code) is the one that avoids adding the CSS classes and the generation of the HTML code in the theme. So you shouldn't need any additional change in front end. Anyway, if something goes wrong or looks bad you can always ask for support :)

...