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.
Options

check only one best answer

jackmaessenjackmaessen ✭✭✭
edited October 2015 in Vanilla 2.0 - 2.8

This is all about a plugin @hgtonight made a while ago, called MarkV. I am trying to make it possible that if a user has hit the anchor for "Best answer" ( a big green V), he cannot hit another anchor on another comment as "Best answer".
Her is some code of the plugin:

 protected function AddMarkV($Sender) {
    $Discussion = $Sender->EventArguments['Discussion'];
    $Session = Gdn::Session();
    $Comment = $Sender->EventArguments['Comment'];
      if($Session->UserID == $Discussion->InsertUserID || $Session->CheckPermission('Garden.Moderation.Manage')) {
      if ($Comment->MarkV) {
        echo Anchor("", 'discussion/markv/' . $Comment->CommentID, 'Hijack img-swap on');
        // if already hit an anchor, all other anchors in the comments should be blocked until the V is disabled; then you can hit again an anchor on a comment
      }
      else {
        echo Anchor("", 'discussion/markv/' . $Comment->CommentID, 'Hijack img-swap');
      }
    }
    else {
      if ($Comment->MarkV) {
        echo Wrap("", 'div', array('class' => 'Hijack img-swap on'));

    }
      else {
        echo Wrap("", 'div', array('class' => 'Hijack img-swap'));
      }
    }
  }

I think i have to do something with this line but i do not know where to put it exactly
$Sender->CommentModel->SetField($Comment->CommentID, 'MarkV', !$Comment->MarkV);

Sign In or Register to comment.