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.
Querying a group of topics in it's own page?
Can someone help me with this? I'm trying to create a page that lists the topics of a particular category in ascending order of their created date. What's the best way to go about this? Can I do it in a pagemanager page?
Example:
Topic 1
January 1, 2007
Topic 2
January 2, 2007
Topic 3
January 3, 2007
etc.
Example:
Topic 1
January 1, 2007
Topic 2
January 2, 2007
Topic 3
January 3, 2007
etc.
0
This discussion has been closed.
Comments
- Look into the blog add-on, as it adopts a standard Vanilla category and lists the posts blog-style.
- Write a extension that fires when somebody saves a comment, check if its in your special category, and somehow prevent the discussion from updating the DateLastActive, either by temporarily turning on the sink attribute or causing the save to exit prematurely.
- I wrote a extension named chronological which will order posts like that--but its very hacky--it switches the DateLastActive database column definition to the DateCreated for the discussions table--this causes all posts to be ordered by DateCreated. While you could technically pull this switch when viewing only one category, when viewing the main discussions page with posts intermixed, the posts will go back to their natural order.
I could help build #2... would have to use the CommentManager PreUpdateDiscussion delegate...function DontBump(&$CommentManager) { $Comment = &$CommentManager->Context->DelegateParameters['Comment']; if (99999 == $Comment->CategoryID) // Replace the 9's with your special category ID here. $s = $CommentManager->Context->ObjectFactory->NewContextObject(&$CommentManager->Context, 'SqlBuilder'); $s->SetMainTable('Discussion', 't'); $s->AddFieldNameValue('CountComments', $this->Context->DatabaseColumns['Discussion']['CountComments'].'+1', '0'); $s->AddFieldNameValue('LastUserID', $this->Context->Session->UserID); $s->AddWhere('t', 'DiscussionID', '', $Comment->DiscussionID, '='); $CommentManager->Context->Database->Update($s, 'DontBump', 'SaveComment', "An error occurred while updating the discussion's comment summary."); if (!$CommentManager->Context->ErrorManager->Iif()) { // Prevent Vanilla form performing its built-in save $UpdateDiscussion = &$CommentManager->DelegateParameters['UpdateDiscussion']; $UpdateDiscussion = 0; } } } $Context->AddToDelegate('CommentManager', 'PreUpdateDiscussion', 'DontBump');
OK, this code is from memory and poking through the CommentManager code so errors are guaranteed to be there. I'll be able to test it later.