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.
Disable posting to a discussion
I have several Categories, but in the "General" category my first message is a welcome to new members and visitors. I want it to always stay at the top and not allow anyone to post more messages to it. I would also like to not have it say, "[Sticky, Closed]" if possible. Any ideas are appreciated!!
www.cfcare.org/forum
0
This discussion has been closed.
Comments
$catID = $_GET['CategoryID']; if ($catID == "1" || empty($catID)) { echo ' <li id="Discussion_0" class="Discussion Read NoNewComments NoReplies Category_1"> <ul> <li class="DiscussionTopic"> <span>discussion topic</span><a href="linkToWelcomeDiscussion">Welcome</a> </li> <li class="DiscussionCategory"> <span>Category </span><a href="linkToGeneralCategory">General</a> </li> <li class="DiscussionStarted"> <span><a href="linkToWelcomeDiscussion">Started by</a> </span><a href="linkToAdminAccount">Admin</a> </li> </ul> </li> '; }
Replacing the links where appropriate
$catID; if (!empty($_GET['CategoryID'])) { $catID = $_GET['CategoryID']; } if ($catID == "1" || empty($catID)) { echo ' <li id="Discussion_0" class="Discussion Read NoNewComments NoReplies Category_1"> <ul> <li class="DiscussionTopic"> <span>discussion topic</span><a href="linkToWelcomeDiscussion">Welcome</a> </li> <li class="DiscussionCategory"> <span>Category </span><a href="linkToGeneralCategory">General</a> </li> <li class="DiscussionStarted"> <span><a href="linkToWelcomeDiscussion">Started by</a> </span><a href="linkToAdminAccount">Admin</a> </li> </ul> </li> '; }
That should fix that undefined index error.
It probably still allows posting in closed discussions because you are the admin account, try making a normal user account and try to post in there.
To make the discussion not show up twice just add this to line 12 of discussion.php (no "s" this time):
$discussionID = $Discussion->DiscussionID; if($discussionID != "3") {
and this to what will now be line 51 (the blank line before $this->CallDelegate('PostDiscussionOptionsRender');):
}
Sorry Vanilla guys for ruining your lovely code
I don't recommend this code I'm writing for everyone, I mean if I were to write an extension for it I would do it better, but as it is this messy workaround should work no problem. Make sure you keep a record of these changes you make though (just make a text file and save my posts in it if you want) so that when a new version of Vanilla comes out you can re-apply them when you upgrade.
Alternatively maybe I have just been unclear in my instructions, so just to be safe here are the changed files for you, just unzip and replace.