Hiding the Edit button on comments
I'm new to all this Vanilla goodness, but I want to use it in my classroom. Please be very elementary in your answers so I know exactly how to implement it.
How do I go about hiding the "edit" button from members (but not administrators)? Or is there a way to see all the different editions of a comment as an administrator? Because I'm working with middle school students, I have to worry about all the different ways they could use this great tool for cheating. They aren't able to delete their comments, so that's good, but I don't know how to stop them from posting the answers to an assignment, then later going back and changing the post to something harmless...
As long as I have a way to see what all the editions of their post said, or disable the edit button...
0
This discussion has been closed.
Comments
if ( $Comment->Context->Session->UserID < 1 && !$Comment->Context->Session->User->Permission('PERMISSION_EDIT_COMMENTS') )
will this really work? it seems to be saying "if your userID is 0 (i.e, you're the admin), AND you don't have permission to edit all comments, then remove the edit links"
shouldn't it be
if ( $Comment->Context->Session->UserID > 0 || !$Comment->Context->Session->User->Permission('PERMISSION_EDIT_COMMENTS') )
instead?
or am i reading it wrong?
as wallphone notes in his addon, this can be bypassed rather easily. i don't think this functionality is fully possible right now without a theme/addon combination, and possibly even some changes to the core.
well, hopefully no threads will be 'edited' anyway
This is a commented excerpt of the code I used:
if (in_array($Context->SelfUrl, array("post.php"))) { // DELEGATION FUNCTION TO VALIDATE EDIT function DiscussionForm_DiceRoller_EditValidation( &$DiscussionForm ) { $pba = $DiscussionForm->PostBackAction; // PREVENT ACCESS TO THE EDIT FORM AND SAVE OPERATIONS FOR COMMENTS // WHICH MEET A CERTAIN CONDITION if ( $DiscussionForm->Comment->CommentID != 0 && ($pba=='' || $pba=='SaveDiscussion' || $pba=='SaveComment') ) { // CHECK THE CONDITION if ( !$DiscussionForm->Context->Session->User->Permission('PERMISSION_EDIT_DISCUSSIONS') ) { // BREAK THE EDIT ATTEMPT $DiscussionForm->Context->WarningCollector->Add( $DiscussionForm->Context->GetDefinition("NoEditWarning") ); $DiscussionForm->FatalError = 1; return; } } } // Add function todelegate $Context->AddToDelegate('DiscussionForm', 'PostLoadData', 'DiscussionForm_DiceRoller_EditValidation' ); }
Hope it helps
Fixed the
edited
=>ed
bug also.