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

Making compatible with voting:

This discussion is related to the ReplyTo addon.

So to make this plugin still work with voting I disabled the sorting in the voting plugin. That was done in the class.voting.plugin.php file on line 137 to 153 by commenting out the following:

public function CommentModel_AfterConstruct_Handler($CommentModel) {
` $Sort = self::CommentSort();

  switch (strtolower($Sort)) {
     case 'date':
        $CommentModel->OrderBy('c.DateInserted');
        break;
     case 'popular':
     default:
        $CommentModel->OrderBy(array('coalesce(c.Score, 0) desc', 'c.CommentID'));
        break;
  }

}`

But now that I look at the code I'm wondering if there might be a way to use this section:

OrderBy(array('c.ParentCommentID', 'asc', 'coalesce(c.Score, 0) desc', 'c.CommentID'));

in the class.replyto.plugin.php file. Because, on line 160 the replyto plugin has:

$Data = $SQL->Select('CommentID')->Select('ParentCommentID') ->From('Comment') ->Where('DiscussionID', $DiscussionID) ->OrderBy('ParentCommentID', 'asc') ->OrderBy('DateInserted', 'asc') ->Get();

So wouldn't it be possible to just add another OrderBy that says if (votingpluginexists) Orderby: c.Score

Sign In or Register to comment.