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.

Must choose a category...

A problem that happens a lot with me is I create a discussion and forget to categorise it... Maybe the combobox should have a "Please choose a category" item and show a dialog telling you you haven't chosen one? No good at php... peace


  • Has anyone built an extension to handle this?
  • edited December 2006
    I used Page Manager to put the default category at the top of the list because people, including myself, were falling for this problem.

    Human interface guidelines would suggest that the category be blank like the discussion topic field when a new discussion is being started.

    I fact, an error string already exists in the language file if the category is left blank: You must select a category for this discussion.

    So all that needs to be done is a mechanism to have --empty-- as the default category when a new discussion is being started. pic
  • I don't see an easy way to turn this into an extension, but you can set an invalid default option by editing Library/Vanilla/Vanilla.Control.DiscussionForm.php, insert on line 208 (inside GetDiscussionForm, just before the while loop): $cs->AddOption(0, 'Please select a category:');
  • edited December 2006
    Can anything similar be done about blank subject lines?
  • Thanks Wallphone it worked of course.
    Another user top-whinge taken care of. pic
  • Just an addendum to WallPhone's solution. Vanilla already assigns a default category if you are viewing a category when you start a new discussion. In order to not clobber that functionality you might want to throw an if around it like so:
    if (ForceIncomingString('CategoryID', '') == '') { $cs->AddOption('', 'Please select a category:'); }

    And insert at line 208 as stated above.
  • edited June 2007
    In 1.1.2 you will have to insert this at line or about 217. (after the $cs variable is declared).
    So it should look something like this

    $cs->Name = 'CategoryID';
    $cs->CssClass = 'CategorySelect';
    $cs->SelectedValue = ForceIncomingInt('CategoryID', $Discussion->CategoryID);
    if (ForceIncomingString('CategoryID', '') == '') {
    $cs->AddOption('', 'Please select a category:');
This discussion has been closed.