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.

REQ: "Select a Category"

edited February 2008 in Vanilla 1.0 Help
Users are complaining because I made the most private categories first in the list to prevent someone from accidentally posting something private to the most general categories. (If I'd done it the other way around, they'd complain that it was the other way around). I'd like a topmost "Select a Category" bit of text that throws an error if they don't change it. Right now I just created a category called Select a Category, but they can still post to it, so it's sort of meaningless.

Comments

  • edited April 2007
    Did you try the Add-Ons MultiRoles or CategoryRoles?

    I think, this could help you...
  • I dont know how to do this as an extension, but if u add this line on library/Vanilla/Vanilla.Control.DiscussionForm.php on line 219 (before the while) :
    $cs->AddOption("-1","Select a Category","");
    This will add it at the top of the list. Anyways, if you try to post with this, you get a bad error msg, so one must someone find a way to use DiscussionForm_PreRender delegate to add it, and use PreSaveComment to catch it. I dont quite understand these things yet. maybe If someone drops us a hint, we can figure it out :)
  • Wanderer has his topmost as blank. so users have to click and make a choice
  • "topmost as blank"... could you please describe it a little bit deeper? Or Wanderer does it itself...
  • Rysk - I'm avoiding too many extraneous add-ons because I was getting a lot of server errors previously so created a fresh install, installed the few add-ons that I needed and voila - no more problems. I'm also afraid that kind of thing could cause future incompatibilities that leave aspects of the forum vulnerable. Also, I'm not sure how the multi-role and category-role add ons would help, but I admit I haven't looked *that* closely at them.
  • edited April 2007
    Mr Do has the right idea. Here is the method used by Wanderer: Must choose a category... # 4 You'll have to move about 10 lines further down than 208, because the core file has changed a bit since I first posted that--at least until the cs is instanciated.

    You might want to wrap an if around it like is suggested two posts later.
  • Thanks Wallphone, worked like a charm.
  • I would still really like to know how to do this in a "proper" way as an extension. For learning purposes :)
  • I suppose you would have to ovverride the select class... I believe its possible with the Object Factory, but I haven't seen it done.

    I don't believe its necessary to catch the error later, the post is still preserved until a proper category is selected, unless you want something other than the standard message displayed.
  • the catch thing i refer to is if u use -1 as value for the default "Select a category" option. then you get lots of bad error msg's if you try to post a discussion without selecting a category.
  • Here ya go, a proper extension: http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=369
This discussion has been closed.