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.

Please give the idea how to get Voting plugin working back

As I know this Voting plugin is outdated. Anybody has an idea how to make it compatible with Vanilla 2.8? I am very liked it. I've read here on forum that it need a hacks in Vanila core which is most difficult thing.

Another question if Vanilla stuff is going to do something similar to this plugin in next versions?

And third, if it's possible to do same with YAGA? I mean to sort the comments by the reaction quantity?

Please, give any idea of that 3 issues.


  • Options
    charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff

    The official (cloud only) reactions allows this type of sorting. Lincoln recently comment on it so I’ll share that with you.

  • Options

    Ok, thanks.

    For All who is looking something similar to Voting plugin - you can use a plugin Rating from R_J. It's compatible with 2.8 and I found it very usefull.

  • Options
    gandra505gandra505 New
    edited April 2020

    SQL query is broken ... in the runtime I have found that following query is trying to execute:

    select CommentID

    from `GDN_Comment` `c`

    where `c`.`DiscussionID` = 1

    order by `coalesce(c`.`Score` asc, `0)` desc, `c`.`CommentID` asc

    This "asc" is wronlgy parsed.

    Following code inside CommentModel_AfterConstruct_Handler:

    $CommentModel->OrderBy(array('coalesce(c.Score, 0) desc', 'c.CommentID'));

    is later wrongly parsed inside library\database\class.sqldriver.php:

    $sql .= "\norder by ".implode(', ', $this->_OrderBys);

    and this produce bad sql

    This is a content of $this->_OrderBys:

    but indded BUG is inside vanilla forum in library\database\class.sqldriver.php inside "public function orderBy". This line of code:

    $fields = explode(',', "$fields $direction");

    Variable $fields has a value "coalesce(c.Score, 0)" but after parsing we have this:

    So not sure if vanilla forum has a bug or plugin has a bug.

  • Options
    gandra505gandra505 New
    edited April 2020

    Simplest fix is to replace following line:

    $CommentModel->OrderBy(array('coalesce(c.Score, 0) desc', 'c.CommentID'));

    with this:

    $CommentModel->OrderBy(array('c.Score desc', 'c.CommentID'));

    inside and plugin will continue to work, maybe with some anothe unexspecte behaviour but for at a first shot is is working :)

    Line 141 is original one and I have commented it and on line 142 is new code which fix the issue:

    I am working with vanilla forum 3.3

  • Options

    Just created PR to fix the issue:

Sign In or Register to comment.