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.
[development] hide comments at runtime via plugin
i need a way to hide certain comments in my plugin if they meet some criteria.
how would you make this happen?
like a hook before comment renders so that i can remove that comment from the loop.
is this achievable?
how would you make this happen?
like a hook before comment renders so that i can remove that comment from the loop.
is this achievable?
0
Comments
public function DiscussionController_BeforeDiscussionRender_Handler(&$Sender) { foreach($Sender->Data['Comments'] as &$cmt) { if(CRITERIA) unset($cmt); } }
A quick find + grep + sort + uniq on my local install gives me these possible handlers:
DiscussionController_AfterBuildPager_Handler($Sender) DiscussionController_AfterCommentBody_Handler(&$Sender) DiscussionController_BeforeBuildPager_Handler($Sender) DiscussionController_BeforeCommentDisplay_Handler($Sender) DiscussionController_BeforeCommentDisplay_Handler(&$Sender) DiscussionController_BeforeCommentsRender_Handler($Sender) DiscussionController_BeforeDiscussion_Handler($Sender) DiscussionController_BeforeDiscussionRender_Handler($Sender) DiscussionController_BeforeDiscussionRender_Handler(&$Sender) DiscussionController_CommentInfo_Handler(&$Sender) DiscussionController_CommentOptions_Handler($Sender)
Examples of the call you want can be found in at least 3 modules:
./plugins/VanillaInThisDiscussion/default.php
./plugins/FeedDiscussions/class.feeddiscussions.plugin.php
./plugins/Signatures/class.signatures.plugin.php
Cheers