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.

Prevent A Single User From Editing His "Own" Posts?

edited May 2007 in Vanilla 1.0 Help
So, a user needs to chill out, but he responds to a moderator edit (which removed a personal attack on another member, a move he should have realized was in his best interest) by editing the moderator's edit, and putting his unfortunate comment back in! One can close a discussion, but this shuts down the otherwise productive discussion. Is there any way to simply remove "edit" permission from a single user (or a Role) so that he may post, but cannot play such games like "edit wars"? Or is there a way to moderate, and thereby change the "ownership" of a post without changing the displayed "posting Member's name" for that post? Yes, one could also simply ban the Member, but this would be heavy-handed. Suggestions?


  • edited May 2007
    In comments.php
    you can make a check on the user ID
    line 114 you can try this
    if ($this->Context->Session->UserID !=5 && $Comment->AuthUserID == $this->Context->Session->UserID)

    add his userid there
  • lechlech Chicagoland
    Hmmm, this might be best utilized in a role rather than against a specific ID but works as implied. Best method would be to simply copy the comments.php to a new template folder and perform that edit so you still have a core to revert to if something goes awry. Although that would make for a pretty good default role permission for users being douchebags else as an add-on.
  • edited May 2007
    you can create an extension pretty easy. save this in default.php
    <?php /* Extension Name: EditRestrictions Extension Url: N/A Description: Do not allow user to edit his/her own post Version: 0.1 Author: Ziyad (MySchizoBuddy) Saeed Author Url: N/A */ $Context->SetDefinition('PERMISSION_CANNOT_EDIT_OWN_POST, 'User not allowed to edit his/her own posts'); $Context->Configuration['PERMISSION_CANNOT_EDIT_OWN_POST'] = '0'; ?>

    Enable the extension
    copy comments.php to a new theme folder for eg to this /path/to/vanilla/themes/theme_name/
    change that line 114 to this
    if (!$this->Context->Session->User->Permission('PERMISSION_CANNOT_EDIT_OWN_POST') && $Comment->AuthUserID == $this->Context->Session->UserID)
    select the new theme as your default theme.

    Create a new role called Douchebag and select that permission, then you can assign any user to this role.
  • lechlech Chicagoland
    Hehe... not bad, Schizo, not bad. Not optimal, but damn that was faster than expected.
  • Wow, thanks... I am impressed. But I don't think I want to call the Role "Douchebag", as user's roles can be seen by everyone. :) I was thinking of something less obvious, like "Members" or "member" (Is lower-case unique from Initial Caps for a Role Name?)
  • Douchebag was only a suggestion, you can call it what you like aslong as you assign it the permission used by this extension.
  • lechlech Chicagoland
    The "douchebag" role has quite the history associated with it... :)
This discussion has been closed.