Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

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

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 Detroit Admin
    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.