Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
554 views
in Q2A Core by
How can I remove the vote-down button by the questions and answers?
Q2A version: 1.7.5

1 Answer

+6 votes
by

Building on my previous answer: http://www.question2answer.org/qa/55614/how-to-make-it-impossible-to-remove-the-upvote?show=55618#a55618

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_down':
  $this->post_hover_button($post, 'vote_down_tags', '–', 'qa-vote-one-button qa-voted-down');
  break;

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

case 'up_only':
  $this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');
  $this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
  break;

case 'enabled':
  $this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');
  $this->post_hover_button($post, 'vote_down_tags', '–', 'qa-vote-second-button qa-vote-down');
  break;

default:
  $this->post_disabled_button($post, 'vote_up_tags', '', 'qa-vote-first-button qa-vote-up');
  $this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
  break;

Into this (just add the double slashes):

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

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

case 'up_only':
  $this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');
//  $this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
  break;

case 'enabled':
  $this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');
//  $this->post_hover_button($post, 'vote_down_tags', '–', 'qa-vote-second-button qa-vote-down');
  break;

default:
  $this->post_disabled_button($post, 'vote_up_tags', '', 'qa-vote-first-button qa-vote-up');
//  $this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
  break;

3. Edit file qa-include/app/votes.php

4. Locate function qa_vote_set and add this:

if ((int)$vote === -1) {
  return;
}

Before this line:

require_once QA_INCLUDE_DIR.'db/points.php';
by
We definitely need a core option here... I am also still forced to use theme hacks.
by
wow i solved many queries after reading so many questionsss.. Thank you all
...