public function DiscussionController_CommentOptions_Handler($Sender) { $Session = Gdn::Session(); $User = $Session->User; $UID = $User->UserID; $DiscussionModel = new DiscussionModel(); $CommentModel = new CommentModel(); $Discussion = $DiscussionModel->GetID($DiscussionID); if ($Sender->EventArguments['Type'] == 'Discussion') { $DiscussionID = $Sender->EventArguments['Discussion']->DiscussionID; if ($Sender->Data['Comments'] instanceof Gdn_DataSet) { $this->LikeModel->PreloadLikes($Sender->Data['Comments']); } $ID = $DiscussionID; $Model = new DiscussionModel(); $Data = $Model->GetID($ID); $Likes = $this->LikeModel->GetDiscussionLikes($ID); $Url = $DiscussionID; } else { $DiscussionID = $Sender->EventArguments['Object']->DiscussionID; $ID = $Sender->EventArguments['Object']->CommentID; $Model = new CommentModel(); $Data = $Model->GetID($ID); $Likes = $this->LikeModel->GetCommentLikes($ID); $Url = $DiscussionID . '/comment/' . $ID; } $InsertID = $Data->InsertUserID; if ($InsertID == $UID) { $Self = TRUE; } else { $Self = FALSE; } // Check for permission. if (!Gdn::Session()->UserID) { $Self = TRUE; } if (!CheckPermission('Plugins.LikeThis.AllowedToLike')) { $Self = TRUE; } $LikeDisplay = $this->FormatLikes($Likes, $Url, $UID, $Self); echo '<span class="Like">' . $LikeDisplay . '</span>'; }