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.

Conditionally Locking Comments

edited April 2011 in Vanilla 2.0 - 2.8
So, I wrote a Dice Roller plugin for the forums and want to add a bit of functionality that basically does something like this:

If (DiceRolled){ Comment.Editable = False; Comment.Deletable = False; }

This is to ensure that once people roll dice in the forum, they can't change those posts.

I've been digging through some of the source code but haven't seen any sort of property / flag I can set.

Is this doable in Vanilla 2? If so, does anyone have recommendations for which source files to check or do you know which properties can be set?

As a last resort, I guess I could add a column to the Comment table that's "DiceRolled" and just manually set / get / check that in the Discussion Controller / Model.

Thanks!
John

Comments

  • Okay, so it looks like the editing rights are checked in the Comment function in the PostController class (line 261).

    However, there are no "magic events" to hook into. The Comment function is pretty big and significant, so it doesn't seem wise to override it on a plugin for such a small piece of functionality.

    Does anyone know if there is a way to get the developers to add a magic event to the main code base?

    I would love a BeforePermissionCheck event or something like that so we could set the $CanEdit variable. It would need to be between the current lines 308 and 309.

    Thanks!
  • Make an issue on the github repo indicating where you would like the even and a potential name. Rather than just including line numbers, include some source code as well where you would like it. Line numbers are constantly changing.
  • Great, thanks!
  • SS ✭✭
    Still dont understand what this plugin do? (Dice roller) Is it a kind of forum game?
  • It's for use with forum games as a way to have some sort of built-in random number generator.
Sign In or Register to comment.