Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Can I set a default category for new discussions?

Right now the dropdown defaults to the first category it sees. Can I set this to another category?

Best Answers

Answers

  • hgtonighthgtonight ∞ · New Moderator

    The dropdown defaults to the category the New Discussion button was clicked in.

    Do you want to change the order of the Dropdown list, or just select a different option by default?

    Also, this is 2.0.18.8, right?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • 2.0.18.8, yes. I was just hoping to set a default category when users select Start a New Discussion from the home page.

  • hgtonighthgtonight ∞ · New Moderator

    To your theme hooks!

    public function PostController_BeforeFormInputs_Handler($Sender) {
      $Sender->Category = CategoryModel::GetFullByUrlCode('category-slug');
    }
    

    Replace category-slug with the last part of the url of the category you want. E.g. if I wanted this page to be the default category to post into: http://localhost/vanilla/index.php?p=/categories/the-watercooler, I would put 'the-watercooler' in there.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    charlieprattlifeisfoovintprox
  • BOOM. Excellence and help at its finest. Thank you.

  • Followup: is there any way to set this so it only does this on the home page and not within specific categories?

  • Is this also possible by using the CategoryID?

Sign In or Register to comment.