Hi,
For this feature we add a new perm change best answer on any Q/A a let the author of the Q/A, the admin or any other with the new perm change the best answer on a Q/A which has already one selected.
There will be a new link change on all the comments but the one currently selected as the best answer.
Along with this, we also add a feedback to the user when a comment is selected.
Regards,

Comments

ec’s picture

StatusFileSize
new2.51 KB

A small bug, It should be a elseif instead of else! New patch added.

ec’s picture

StatusFileSize
new6.78 KB

Hi,
This new patch uses the code refactoring I introduced in https://drupal.org/node/1689720#comment-6267892 for the deselect feature.
So this new patch introduces 2 new perms, one for "own" and one for "any" question.
This patch works as a standalone, that is to say that it doesn't need any other patch to work. Hence you can test this new change link. The use case for this is for example when after a long time with inactivity someone post a new comment more accurate to answer a question which has already a best answer selected. In this case we don't need to deselect and then select a new one. This can be done in one step.
Please let me know, thanks,

jcisio’s picture

Assigned: Unassigned » jcisio
Status: Needs review » Needs work

I'll modify this patch to add the support for deselecting an answer for moderation purpose. The use case is when a moderator think the selected answer is not good, or it was selected by error. So the answer could be deselected, and leave time/room for new answer.

jcisio’s picture

Status: Needs work » Needs review

I refactor a bit more, add the "deselect" permissions. Only tested with uid 1, could you test the permission for 1/ author 2/ someone with permission but other than uid 1?

Then I think it'd be good to commit.

jcisio’s picture

StatusFileSize
new9 KB

There should have been a patch ;)

jcisio’s picture

Assigned: jcisio » Unassigned
ec’s picture

Status: Needs review » Reviewed & tested by the community

Hi Jcisio,
Sorry for the delay, I'm just back from holidays. I've try your patch in #5 on my test website and, so far, it looks to work very well for all types of users.
So +1 for it.
BTW, your code refactoring is way better than mine ;-)
Best,

ec’s picture

I found one minor issue. In question_answer.pages.inc line 24 we should have this:

$node->{$qtype[$node->type]['answer']}[0]['value'] = ($action == 'deselect') ? '' : $cid;

instead of this:

$node->{$qtype[$node->type]['answer']}[0]['value'] = ($action == 'deselect') ? 0 : $cid;

because when we are using duration the system check for an empty field and not a field filled with 0.

jcisio’s picture

Yes that should be changed. However it is an integer field, I don't think '' or '0' matter (I think the default value even is NULL).

ec’s picture

Yes this :

$node->{$qtype[$node->type]['answer']}[0]['value'] = ($action == 'deselect') ? NULL : $cid;

works well too.

jcisio’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed. Move to 7.x queue for forward port.

jcisio’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.