Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Developer needed "Start a new discussion", approving before making it public
Hello,
I would like a extension that sends every new discussion to the Admin for approval before allowing it to show up. Is something like this available?
Thank you!
0
This discussion has been closed.
Comments
You'd also need an option in the roles to assign moderating options to a role.
You should probably also make a 'your comment has been saved and is pending administrative approval' message to keep users from aassuming it didin't post and re-posting ad infinitum.
edit: Doh! beaten by five minutes. I sound like a broken record.
<?php /* Extension Name: Pre Approval Extension Url: http://lussumo.com/docs/ Description: Sets all discussions and comments as deleted by default. It is then up to the administrator to 'approve' comments before they are visible Version: .1 Author: Your Name Here Author Url: http://example.com/ */ if ( 'post.php' == $Context->SelfUrl ) { function PreApproval_NewComment(&$Comment) { if ( !$Comment->Context->Session->User->Permission('PERMISSION_VIEW_HIDDEN_COMMENTS') ) { $Comment->Deleted = 1; $Comment->DeleteUsername = 'Pending Approval'; } } $Context->AddToDelegate('CommentManager','PreSaveNewComment','PreApproval_NewComment'); } ?>
Basically what is happening, first we check that we are on the post page (saving a comment/discussion) then we create a function that checks if the person logged in has permission to view hidden discussions. If they don't, the extension sets the comment to deleted and puts a message in the delete user name field (I am not sure if it would work to put that there.)
We next attach to the delegate that happens right before Vanilla saves a new comment to the database. This code needs some debugging and possibly attaching to another delegate to mark new discussions as deleted ($Discussion->Active = 0)
Why exactly do you want to do this.