Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Disable voting on comments (ie: allow votes only on threads)?

This discussion is related to the Voting addon.
edited December 2010 in Vanilla 2.0 - 2.8
Hi, I'd like to use the voting addon as a way of tracking thread popularity. Is there a way to disable the per-comment voting? Thank you.

Comments

  • I want this to! I searched for it bot Nothing. Please someone that can help to Make only the Discussion Voted give a help :)
  • I would love this option too!
  • LincLinc Director of Development Detroit Vanilla Staff
    There's no option to disable it, no. It wouldn't be terribly difficult to accomplish, but it would require basic PHP/Vanilla plugin skills.
  • Find function:
    public function DiscussionController_BeforeCommentMeta_Handler($Sender) {

    Add code:
    if(GetValue('VoteHeaderWritten', $Sender)) return;

    Enjoy! :)

  • You'll also probably want to comment this out from
    public function DiscussionController_BeforeCommentDisplay_Handler($Sender) {

    echo ' sorted by <ul> <li'.(self::CommentSort() == 'popular' ? ' class="Active"' : '').'>'.Anchor('Votes', Url('?Sort=popular', TRUE), '', array('rel' => 'nofollow')).'</li> <li'.(self::CommentSort() == 'date' ? ' class="Active"' : '').'>'.Anchor('Date Added', Url('?Sort=date', TRUE), '', array('rel' => 'nofollow')).'</li> </ul>';

    And then add in a <br> after the
    ?>

    So in total it should look like:
    /* echo ' sorted by <ul> <li'.(self::CommentSort() == 'popular' ? ' class="Active"' : '').'>'.Anchor('Votes', Url('?Sort=popular', TRUE), '', array('rel' => 'nofollow')).'</li> <li'.(self::CommentSort() == 'date' ? ' class="Active"' : '').'>'.Anchor('Date Added', Url('?Sort=date', TRUE), '', array('rel' => 'nofollow')).'</li> </ul>'; */ ?> <br>

  • edited February 2015

    I follow the above steps (but, the code has changed since then so I'll paste my exact steps below), and voting is indeed removed from the first comment but it is present in all subsequent comments.

    PROCEDURE:

    1. Comment out lines 192-196:
    //              echo ' sorted by '
    //               .Anchor('Votes', Url(DiscussionUrl($Sender->Discussion).'?Sort=popular', TRUE), '', array('rel' => 'nofollow', 'class' => self::CommentSort() == 'popular' ? 'Active' : ''))
    //               .' '
    //               .Anchor('Date Added', Url(DiscussionUrl($Sender->Discussion).'?Sort=date', TRUE), '', array('rel' => 'nofollow', 'class' => self::CommentSort() == 'date' ? 'Active' : ''));
    
    1. Add <br /> after line 198

    2. Add the second and third line below after line 206:

        public function DiscussionController_AfterCommentMeta_Handler($Sender) {
          if(GetValue('VoteHeaderWritten', $Sender))
            return;
    

    OBSERVED RESULT:

    • Discussion still has voting button (good)
    • First comment I post has no voting button (good)
    • Second and all subsequent comments I make immediately after DO have voting buttons (bad)

    Any idea?

    Thanks,
    David

  • Here is a screenshot to prove it... :-)

  • Hm, it seems when I refresh the screen that the unwanted voting buttons disappear - good!

    So I guess this is not a killer.

    Would be good to fix this bug though?

Sign In or Register to comment.