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.
Options

How do you insert a new discussion that is always below all the others?

edited October 2008 in Vanilla 1.0 Help
Hi Vanilla community: Here's what I want to do. I have an application that inserts discussions into vanilla. I always want these inserts to be below all the vanilla natural discussions. What I mean by natural is when a person normally hits the "start a new discussion" link. it creates what a normal natural discussion. So, if I add discussions below that (say Testimonial discussions), I want these testimonials to always show below the natural discussions regardless of the date modified. I'd rather not mark all natural discussions sticky. I don't mind marking all the testimonials as sink, but that doesn't work since it's New it always goes on top. Any suggestions? hmm, maybe that's it. I want to sort by sink then by discussion last mod time. So, how do I do that? Is there an easy way to change the default sort of the discussion list? Thanks in advance.

Comments

  • Options
    do you also want them to appear in the first page of discussions?
  • Options
    You might want to look at discussion "sinking". Vanilla lets you "Sink Discussion" when you're viewing it as a user with "Sink" privileges.
  • Options
    but sinking a discussion will let it flow from the top to the bottom when new comments are posted in other discussions, but it won't be by default at the bottom

    (if I'm not bad)
  • Options
    I did try "sinking". And because these discussions are new, they still bubble at the top. --Miquel is right on. I don't want them to appear in the first page of discussions. I'm programmatically entering these discussions into the database from another application, so I can make whatever changes necessary if there are any properties in the tables that will disallow them to show up on the first page or if there is an extension that prevents "sunk" conversations from hitting the front page that would be good. I could back date them, but I like knowing the date they were submitted. Any suggestions?
  • Options
    Well you can manually tell Vanilla to ignore certain discussion IDs ;) *ducks the punches from people who don't like my hackish solutions*
    Disclaimer: Make a note of this change because when/if you update Vanilla the change will be erased and you will need to put it back to maintain this new functionality. If you accept this, here is how to prevent certain discussions from showing up in any discussion list:

    Open discussion.php and add this to line 12 (currently a blank line): $discussionId = $Discussion->DiscussionID; if ($discussionId != "31" && $discussionId != "35") { but change the numbers to the right numbers, if you don't know how to find the IDs just ask. Also add this to line 50: }
  • Options
    If you're adding them into the db yourself wouldnt you just be best setting the date to some time a while ago?
  • Options
    He said he didn't want to, just above my post :)
  • Options
    Well surely he wouldnt have to back date them - just date them to when they were first created anyway? If that's not before the oldest discussion on his front page then surely they're fresh and suitable enough for the list? If he removes them he wont may as well not add them in the first place.
  • Options
    To Minisweeper:
    Yeah I'm not quite clear on why he would want to do it either, definitely a unique request :)
    But I dunno, maybe there is a good reason for it, I know sometimes I need to do weird things with code so I'm not one to judge :) One reason could be that he wants the discussions to show up in searches but not on discussions pages (in which case the code I provided above won't work, ssta)

    To sstawarz:
    The exact functionality you are requesting would require some bigger code changes, the code I gave you is a way to stop those discussions from being accessible via the UI, but I now realize that may not have the desired effect. Let me know if you want to do a big code change to make that work and I might be able to help.
  • Options
    Thanks SubJunk & Minisweeper for your response. See my Forum doesn't get that much activity. We use it more as a document|Article management system. --- So, many of my articles have older dates and don't always receive a lot of comments to keep them fresh and up on the main discussion page, and I don't want to mark them sticky as I still like to see discussion articles float by date. then, I also have a discussion category that I want the public to see that is more like a testimonial section. In another web app, the new user of our product is asked a question (that rotates every so often), currently it is why did you buy our product. I programmatically add the answer to the db tables in the forum which of course is free for the public to see. So, I want the date the testimonial is added to be the actual date. This way prospective clients can go to this page and see all the responses. Employees can go there to see the answers to the questions, and respond to comments as needed. To avoid writing code and to try to keep things simple, I thought integrating my testimonials in to my forum would be an easy quick solution. However, I have noticed that the testimonails (sometimes noise) tend to drown out the articles (most of the signal). I still want the testimonials to show up, but I thought it might be nice and easy to leave them off the first page of Discussions. I might try SubJunk's solution, but I'm not sure if that will do it. I might have dig into the discussion.php file. I was just thinking there might be an easy way. In other words, I almost want a priority level. All discussions with a high priority are sorted above the discussions marked with low priority. So, yes, I'm making Vanilla (a discussion forum) do what it's not meant for (Article and Testimonial Management)
  • Options
    Well if you are familiar with PHP/MySQL it shouldn't be too hard. You can create a new boolean switch column in the discussions table in the database called "testimonials", so when you add a testimonial you mark that field true, and make it 0 by default so that ones Vanilla adds are false. Then you can ORDER BY testimonial, date.
    If that doesn't make sense just say and I can give you the code
  • Options
    Thanks SubJunk. --- Where do I order By? I was digging in the Discussion.php theme files and the framework files, and I don't see where the discussion.php sorts the discussions. I did hack it by back-dating the "DateLastActive" - 10 years, but I'd rather do the boolean column. If you can tell me where the Order By would go in the discussion page, that would be great, I can add the column and everything. Thanks again.
  • Options
    Yeah it's something we will have to hack in there. Let me do a test here and I'll post back when I've got it.
This discussion has been closed.