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?

edited July 2007 in Vanilla 1.0 Help
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.

Comments

  • Few options:
    1. Look into the blog add-on, as it adopts a standard Vanilla category and lists the posts blog-style.
    2. 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.
    3. 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.
  • Hey Wallphone, thanks for the feedback. This is actually relating to the blog addon as I'm trying to create a chronological archives page for just the blog category (similar to what you would expect from Wordpress, Blogger, etc.). Each title would then link to the discussion. Does that Make sense?
  • OK, so for example, your blog category ID is 40, so anything posted to that category should not bump? (i.e. turn on sink automatically for every blog post) Or they should bump when reading by the all discussions view, but when you view just the category's posts they should be listed chronologically--the same order as they do on the blog tab? Or... your blog tab ... already looks like this... or do you want to be able to view by month?
  • Actually, what I think I need is more simple than that. I basically just need a page that lists all the topics in the blog category 40. If it can be done by month, that would be great. But just a simple listing of the topic titles with the date in chronological order. I don't need author info, last comment, etc. I hope that makes sense. Thank you for your help!
This discussion has been closed.