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.
Category-level stickies
Is is possible to make a sticky only stay at the top in its category? I'm planning a large forum, and the stickies will quickly flood the discussion list.
If it isn't currently possible, I might tackle it as my first plugin for Vanilla. Without digging into the internals yet, it sounds like the best way to implement it would be to set up a new table of "super stickies", suppress normal stickies from showing on the main discussion list, and then displaying "super stickies" on the main list. There would then be a corresponding new permission of "super sticky" to dole out appropriately. Is this the right way to go about it, and is it something reasonable to tackle having to experience in Vanilla?
If it isn't currently possible, I might tackle it as my first plugin for Vanilla. Without digging into the internals yet, it sounds like the best way to implement it would be to set up a new table of "super stickies", suppress normal stickies from showing on the main discussion list, and then displaying "super stickies" on the main list. There would then be a corresponding new permission of "super sticky" to dole out appropriately. Is this the right way to go about it, and is it something reasonable to tackle having to experience in Vanilla?
1
Comments
Regarding super-stickies, you would have to develop that yourself.
/cd
Displaying all announcements across all categories when displaying all discussions means that the use of announcements as "stickies" to describe features of the category falls down completely.
That may offer something of what you are trying to achieve.
$this->AnnounceData = $Page == 0 ? $DiscussionModel->GetAnnouncements() : FALSE; $this->SetData('Announcements', $this->AnnounceData !== FALSE ? $this->AnnounceData : array(), TRUE);
with
$this->SetData('Announcements', array());
If I understand what's going on here, those two lines are a special handling clause for displaying all stickies on the homepage. Take that out, and hard-code the default handling condition, and now I've got no stickies on my homepage.
This solves 1/2 my issue, but obviously doesn't give me the ability to write home-page stickies. Before I tackle that (which will require adding a table or adding a column to the existing discussions table), I've got to figure out how to package it as a plugin instead of hacking the core.
In that view, which will be protected from core vanilla upgrades, you can add conditions to determine when to display the announcements. That view is run from the categories controller or the discussions controller, depending on whether a category is selected.
/* JDJ: do not display announcements unless we are in a category, ie the category under which the announcements are posted. */ if (!empty($this->Category)) { $Alt = ''; if (property_exists($this, 'AnnounceData') && is_object($this->AnnounceData)) { foreach ($this->AnnounceData->Result() as $Discussion) { $Alt = $Alt == ' Alt' ? '' : ' Alt'; WriteDiscussion($Discussion, $this, $Session, $Alt); } } }
I have just wrapped an if-statement around the loop that displays the announcements at the top. To be honest, it now makes a lot more sense to the users now, as the announcements are all in context.
If there is a way to label announcements as front-page types, then instead of the condition wrapping the whole list, you could check each announcement in turn to see if it is relevant, i.e. if no category is selected, then only display announcements with the "front page" flag set, otherwise only display announcements without the flag set.
As a really quick hack, you could check for a certain keyword or tag in the announcement title or body to indicate that it should appear on the front page. That would involve no other changes to the code or database.
Did anyone find an elegant solution for this, or is the above code the best option?
This is how the announce popup looks in 2.1.