Unfortunately the configuration doesn't provide an option to disable awarding points only for accepting self-answers. You can set the amount of points awarded for accepting an answer to zero, but that would disable reputation for accepting an answer entirely.
If you want reputation to be gained only for accepting someone else's answer you need to modify the code. The relevant part is in the file qa-include/db/points.php
. Find the following section in that file (for version 1.8.5 it's lines 77 through 80):
'aselects' => array(
'multiple' => $options['points_multiple'] * $options['points_select_a'],
'formula' => "COUNT(*) AS aselects FROM ^posts AS userid_src WHERE userid~ AND type='Q' AND selchildid IS NOT NULL",
),
and change it to this:
'aselects' => array(
'multiple' => $options['points_multiple'] * $options['points_select_a'],
'formula' => "COUNT(*) AS aselects FROM ^posts AS userid_src JOIN ^posts AS answers ON userid_src.selchildid=answers.postid WHERE userid_src.userid~ AND userid_src.type='Q' AND (userid_src.userid<>answers.userid)",
),
The formula gets expanded to
SELECT
userid_src.userid,
COUNT(*) AS aselects
FROM qa_posts AS userid_src
JOIN qa_posts AS answers ON userid_src.selchildid=answers.postid
WHERE userid_src.userid BETWEEN # AND # AND
userid_src.type='Q' AND
(userid_src.userid<>answers.userid)
GROUP BY userid
which joins the posts table with itself by matching the field selchildid
of the question records to the field postid
of the answer records. The clause userid_src.userid<>answers.userid
ensures that only records are selected where the user posting the question is different from the user posting the answer. The query then groups the results by user ID and returns a recordset with user IDs and the number of answers they accepted.
With that said, note that patching the core application code has the disadvantage that your changes will be lost after updating to a new version. A better approach would be to create a custom plugin where you can override the routine that generates the associative array with the points calculation queries.
In your override function you'd essentially just call the original function (append the suffix _base
to the function name to do so), then update the formula for the aselects
key and return the modified associative array:
function qa_db_points_calculations() {
$points_calculations = qa_db_points_calculations_base();
$points_calculations['aselects']['formula'] = "COUNT(*) AS aselects FROM ...";
return $points_calculations;
}
The complete plugin can be downloaded from here.