The function vote_up_down_vote in vote_up_down.module causes the following bug:

The author of a comment can vote on his own comment and can get userpoints for doing so. This does not happen when the author of a node votes on his own node, ie he doesn't get userpoints for voting on his own node.

I was able to fix it as follows:

Replace: $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.uid FROM {node} n WHERE n.nid = %d'), $cid));

With:

if ($type == 'node') {
$node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.uid FROM {node} n WHERE n.nid = %d'), $cid));
} else {
$node = db_fetch_object(db_query(db_rewrite_sql('SELECT c.uid FROM {comments} c WHERE c.cid = %d'), $cid));
}

Any comments?

Comments

frjo’s picture

Assigned: Unassigned » frjo

Looks OK to me, I will test it and if I fins no problems commit it to HEAD.

frjo’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)