Notifications
Clear all
Topic starter
25/12/2018 10:06 pm
Hi!
Tell me please. How to move the voting block up comment?
In class.WpdiscuzWalker.php I found the code responsible for voting
if (!$this->optionsSerialized->votingButtonsShowHide) {
if ($args['can_user_vote']) {
$voteClass = ' wc_vote wc_not_clicked';
$voteUp = $this->optionsSerialized->phrases['wc_vote_up'];
$voteDown = $this->optionsSerialized->phrases['wc_vote_down'];
} else {
$voteClass = '';
$voteUp = $this->optionsSerialized->phrases['wc_login_to_vote'];
$voteDown = $this->optionsSerialized->phrases['wc_login_to_vote'];
}
$voteUpClasses = apply_filters('wpdiscuz_vote_up_icon_classes', array('fas', $args['voting_icons']['like'], 'wc-vote-img-up'), $comment, $args['current_user']);
$voteDownClasses = apply_filters('wpdiscuz_vote_down_icon_classes', array('fas', $args['voting_icons']['dislike'], 'wc-vote-img-down'), $comment, $args['current_user']);
if ($this->optionsSerialized->votingButtonsStyle) {
$votesArr = $this->dbManager->getVotes($comment->comment_ID);
if ($votesArr && count($votesArr) == 1) {
$like = 0;
$dislike = 0;
} else {
$like = isset($votesArr[0]) ? intval($votesArr[0]) : 0;
$dislike = isset($votesArr[1]) ? intval($votesArr[1]) : 0;
}
$commentOutput .= '<span class="wc-vote-link wc-up wc-separate' . $voteClass . '">';
$commentOutput .= '<i class="' . implode(' ', $voteUpClasses) . '"></i><span>' . $voteUp . '</span>';
$commentOutput .= '</span>';
$commentOutput .= '<span class="wc-vote-result wc-vote-result-like' . (($like) ? ' wc-positive' : '') . '">' . $like . '</span>';
$commentOutput .= '<span class="wc-vote-result wc-vote-result-dislike' . (($dislike) ? ' wc-negative' : '') . '">' . $dislike . '</span>';
$commentOutput .= '<span class="wc-vote-link wc-down wc-separate' . $voteClass . '">';
$commentOutput .= '<i class="' . implode(' ', $voteDownClasses) . '"></i><span>' . $voteDown . '</span>';
$commentOutput .= '</span>';
} else {
$voteCount = get_comment_meta($comment->comment_ID, WpdiscuzCore::META_KEY_VOTES, true);
$commentOutput .= '<span class="wc-vote-link wc-up' . $voteClass . '">';
$commentOutput .= '<i class="' . implode(' ', $voteUpClasses) . '"></i><span>' . $voteUp . '</span>';
$commentOutput .= '</span>';
$commentOutput .= '<span class="wc-vote-result">' . intval($voteCount) . '</span>';
$commentOutput .= '<span class="wc-vote-link wc-down' . $voteClass . '">';
$commentOutput .= '<i class="' . implode(' ', $voteDownClasses) . '"></i><span>' . $voteDown . '</span>';
$commentOutput .= '</span> ';
}
}
And moved to <div class="wc-comment-header"> but the ajax stopped working when voting
This topic was modified 6 years ago by Minusator
26/12/2018 5:08 pm
Hi @igjijklgf4,
Some JS functions of voting actions search voting div's in <div class="wc-comment-footer"> div. So if you move voting buttons they must have wrapper div wc-comment-footer class.
Minusator reacted