Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to make it impossible to remove the upvote?

+1 vote
105 views
asked Jan 2, 2017 in Q2A Core by Jonatan
Some users of my site give upvote and remove. Then give upvote again and remove. Again and again.

The purpose of this is to generate tens or hundreds of notifications and disrupt the user (persecuted) view notifications of messages and comments.

It would be interesting if the vote were impossible to change, to avoid this.
Q2A version: 1.7
commented Jan 2, 2017 by pupi1985
Good point. Funny thing is that those guys are by definition spammers :/

1 Answer

+1 vote
answered Jan 2, 2017 by pupi1985
selected Jan 2, 2017 by Jonatan
 
Best answer

There is no setting to do so. You'll have to modify code. This can be done with a layer (or even modifying the theme) and an override. However, here are the corehacks with the changes.

1. Edit qa-include/qa-theme-base.php

2. Locate function vote_buttons and edit it this way (this sets up the user interface and is just for cosmetic purposes):

Turn this:

case 'voted_up':
    $this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-voted-up');
    break;

case 'voted_up_disabled':
    $this->post_disabled_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-vote-up');
    break;

case 'voted_down':
    $this->post_hover_button($post, 'vote_down_tags', '–', 'qa-vote-one-button qa-voted-down');
    break;

Into this (just add the double slashes):

case 'voted_up':
//    $this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-voted-up');
//    break;

case 'voted_up_disabled':
    $this->post_disabled_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-vote-up');
    break;

case 'voted_down':
//    $this->post_hover_button($post, 'vote_down_tags', '–', 'qa-vote-one-button qa-voted-down');
//    break;

3. Edit file qa-include/app/votes

4. Locate function qa_vote_set and add this:

if ($post['uservote'] != 0) {
    return;
}

Before this line:

require_once QA_INCLUDE_DIR.'db/points.php';

commented Jan 2, 2017 by Jonatan
Great answer, Gabriel!

Thank you very much!
...