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.

removing 'edit' post option after specified time?

edited August 2006 in Vanilla 1.0 Help
I did a quick search, didn't see anything related to this...

What I'd like to have is some way to set a time, for example - 2 days, and then have the 'edit post' button/option disappear for users after the 2 days have passed since the made the post. Is there an easy way to do that? Even if someone knows what code to edit, I'll give it a go. But I'm guessing that something like can be relatively easily made into an add-on?

Thanks for any help. :)


  • Options
    edited August 2006
    I recon probably the best way is to copy the comments.php file from /themes/ into /themes/vanilla/, find line 109, and change it from: if ($Comment->AuthUserID == $this->Context->Session->UserID || $PERMISSION_EDIT_COMMENTS || $PERMISSION_EDIT_DISCUSSIONS) { to: if (($Comment->AuthUserID == $this->Context->Session->UserID || $PERMISSION_EDIT_COMMENTS || $PERMISSION_EDIT_DISCUSSIONS) && ($Comment->DateCreated - time()) < NUMBEROFSECONDSYOUWANTASAMAXIMUM) { where NUMBEROFSECONDSYOUWANTASAMAXIMUM (for 2 days you want it at about 180000)
  • Options
    ahh... looks like that should do the trick. I'll make this change when i get some spare time. cheers Minisweeper!
  • Options
    This eliminates the edit button, but a wise user may still use the CommentID to access the edit form directly in a URL. If you want to really block the possibility to edit a comment you should do as I describe in Skipping the edit button in a comment.

    If you need the exact code I'm using for that part, just tell me. I'm working now in another computer but I may get it for you in a while.
This discussion has been closed.