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.

Roll your own discussions listings question.

edited March 2007 in Vanilla 1.0 Help
I'm new to Vanilla (and PHP) so this is likely to be a boneheaded question, but I'd like to be able to format my own SQL queries (i.e. w/o using sqlbuilder) and use the results to populate my discussions page. I've got the SQL working fine, but I'm unsure as to where to go from here. Any hints?


  • Options
    edited March 2007
    I believe the delegate you would want to use is the CommentManager's DiscussionManager's PreGetDiscussionList, (/library/Vanilla/Vanilla.Class.DiscussionManager.php) although I'm not sure if you would be able to replace the SQL in the builder directly with a pre-written query.

    But this begs the question of what you want to accomplish. The discussion list query is very complex, and different depending on the user browsing the forum--accounting for whispers, stickies, sink, blocked categories, etc. and this would be hard to account for all of these variables.

    edit: I meant discussion manager :-)
  • Options
    Thanks for the advice - I've decided that I'm going to try to get sqlbuilder to work for me. Do you know of a way to perform a DB function inside the addwhere function? What I'd like to be able to do is format the column data before the comparison. In my case: $s->AddWhere('t','Date(DateCreated)','',$Index_Date,'='); I'd like to compare just the date and not the entire datestamp. The MySQL chokes on the above snippet.
  • Options
    I believe you need to add the formatting function as a select parameter and then do the comparision: $s->AddSelect('t','Date(DateCreated) AS MyDateFormat'); $s->AddWhere('t','MyDateFormat','',$Index_Date,'='); I don't know the order of the parameters off the top of my head, so that may need a bit of tweaking.
This discussion has been closed.