Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.


This discussion is related to the SubCategories addon.


  • I think Pol's request is similar to my own - that is to say, I don't want people posting in the 'parent' category
  • Structurally, that's real easy if you combine it with Category Roles. Just set the parent category to read-only. Visually/style-wise, getting the sub-categories to show up on the main category page will require some modification of categories.php and/or sub-categories.php.
  • thanks timfire - do I need another add-on to make a category read only - as far as I know I can only make a category visible/invisible to certain roles and don't the ability to alter to read/write access so further info would be a great help, thanks.
  • @timfire: Yeah, I already got the Category Roles bit. Thanks. I'll see if I can figure out a way to get the templates to do what I want...

    @conradslater: It's a separate add-on.
  • For anyone that is still having problems with SubCategories not showing up because there are special characters in a Category name, the solution is simple:

    Add the following:

    function IsSubCategory($Category, $CurrentName = '', $Zealous = 0) {
    $CurrentName = html_entity_decode($CurrentName,ENT_QUOTES);
    Note that this uses the fix I provided in the comments above, so be sure to check those out too.
  • I don't think this extension is working for me but I want to make sure it does what I think it does before I start troubleshooting.

    What I have done...
    I have made the following categories:
    CO2 Incubators
    - Troubleshooting
    - - The Temperature is Too High
    - - The Temperature is Too Low
    Bactron User Group

    There are discussions in the Bactron User Group but that does not matter since I don't need subcategories there.

    In the CO2 Incubator category only the sub sub categories ("The Temperature is Too High" and "The Temperature is Too Low") have discussions in them.

    I have started a discussion in "The Temperature is Too High" titled "Possible Cause is the Controller"

    My Issues:
    In Vanilla, when I click on Categories I only see CO2 Incubators and Bactron User Group. If I click on CO2 Incubators I do not see the sub category. It says "No discussions found". Should I see the subcategory here?

    The discussion I started shows up on the front page of "Discussions". When I click on it I see the post. The breadcrumb shows the cat and the sub sub cat but is missing the sub category. It is "CO2 Incubators > The Temperature is Too High » Possible Cause is the Controller". Why is the subcategory "Troubleshooting" missing?

    Something is not right, correct?

    Any ideas what could be wrong. I have not made any mods to the system. I have added the following themes and extensions.


    Applicant Email Verification
    Html Formatter
    Preview Post

    Everything is up to date.

    Thanks for any help
  • Thanks Peterbp. That worked and I saw that was even in the readme. So shame on me for not reading :).

    I wanted to mention this.

    As I added Categories and SubCategories they were in the correct order (just by chance). I still could not get this extension to work. I then reordered the categories (took them out of order) and then put them back in the correct order. Then everything started working. It seems (for me) that the reordering of the categories step is necessary even if they happen to be in the correct order upon creation. Might have just been my setup but I thought it might help someone else.

  • Installed it and worked great.

    One feature request: In the categories view, could each parent topic have a listing of the sub-categories in it? A forum listing might look like:

    # Support Questions
    # Category description Technical help about the XO laptop. Synced with the mailing list.
    # Discussions: 280 | Sub-forums: Software, Hardware, Networking

    If you give me some insight into *how* to implement that (any similar code samples I could use as a reference?) I would even be willing to try. From there are other neat things we could do form their (have discussion # for each sub-forum being listed, etc), but that is just my daydreaming.
  • Subcategories has been working fine for me, but for some reason, recently the order of categories and subcategories has changed.
    Start a new discussion -> select the category for this discussion.
    From the drop down box, the categories are not in the same order as they have been placed.

    I have clicked on settings and categories and they are in the original order there.
    I have also tried to change the order from there, but they still show in the wrong order.

    Can anybody help, please ?
    Thanks in advance
  • Does anybody have any ideas, please ? :-) (SubCategories # 100)
  • Hello everyone,

    I have installed the subcategory extension and it seems to be working except for the fact that they will not show up on the parent category page. I have created a test discussion and they show up in the discussions section, when you click on the discussion that was created in that subcategory along the top it shows that it is placed in the correct place. but I am still unable to view them from the parent categories page. I have edited the the categories.php file and that does not seem to wrok. can you please let me know what I can do to resolve this.

    Thank you
  • ok can someone fix this: ?

    when notify sends an email to my members they get a link
    (a private message)
    if they are not already logged in
    it gives errors
    and it ruins the site
    cuz it messes everything up

    Notice: Trying to get property of non-object in /***/discussions/extensions/SubCategories/default.php on line 389

    Notice: Trying to get property of non-object in /***/discussions/extensions/SubCategories/default.php on line 390

    help me plz
    thank you
  • do you have friendly urls?
  • no i do not have it installed
  • ok; I saw in you url it had .../discussions/... in it, and it seemed as if maybe friendly urls was messing it up by adding that in, but I guess your forum must be contained in a folder called discussions?
  • wait umm
    it used to
    but i changed it to community
    so maybe after i changed it
    it got messed up
  • try disabling, then re-enabling notify and subcategories
  • i did that a few times
    it did not work
  • look through your */conf/settings.php file fr any incorrect entries. (any instance of .../discussions/...) and fix them
  • tried that but no everything is community
  • So I installed this extension and did everything right.

    Yet when I make my subcategories they always show in my top Category, and I can not figure out why.

    Like so:

    - Playstation

    The Playstation subcategory would show in the General category.

    Another example.

    - Playstation

    The Playstation sub category again would be showing in Console the top category.

    Any ideas that could help me out?
  • This is pretty important extension for me, anyone that can help?
  • Well I have abandoned the use of Vanilla due to not being able to figure this out, if anyone would like to enlighten me down the road, my aim is steven1022 and msn is I have went with phpbb unfortunately due to the non responsive community here. Will not be returning most likely, bye.
  • Thank you very much for this much needed extension!

    The following produces an error:
    Category 1
    - SubCategory 1
    - - SubSubCategory 1
    - SubCategory 2
    - - SubSubCategory 1

    Both of the SubSub categories are displayed inside of SubCategory 1, while SubCategory 2 does not contain any subcategories! (subcategory counts are correct though). Thank you.

    P.S.: Please see the other discussions that I started, both titled "Subcategories: etc.". I have posted this one here since this seems to be the place where the discussion is really alive :)
  • Is there a way of making the sub-categories display after the discussions?
  • Anyone working on an answer to the last question?

    Or can at least provide some guidance as to how this should be approached?
  • To fix the problem with
    Notice: Trying to get property of non-object in /***/discussions/extensions/SubCategories/default.php on line 389 Notice: Trying to get property of non-object in /***/discussions/extensions/SubCategories/default.php on line 390
    add the following code to default.php:389
    if ($CommentGrid == null || $CommentGrid->Discussion == null) return;
  • work with latest version of vanilla 1.1.5a???????
  • steven1022 said:

    Yet when I make my subcategories they always show in my top Category, and I can not figure out why. Like so:
    - Playstation
    The Playstation subcategory would show in the General category.

    I had the same problem, and I think I found out why:

    To get the Priority of the current category, default.php uses this sqlbuilder:
    $s = $Context->ObjectFactory->NewContextObject($Context, 'SqlBuilder');
    However, to find the parent, default.php uses this sqlbuilder:
    $s = $CategoryManager->GetCategoryBuilder(0, 1);
    When you check the code of Categorymanager, you see that its sqlbuilder does not look at priorities:
    $s->AddSelect(array('CategoryID', 'Name', 'Description'), 'c', '', '', '', 1);
    When you change the second sqlbuilder in default.php to
    $s = $Context->ObjectFactory->NewContextObject($Context, 'SqlBuilder');
    and add
    $s->SetMainTable('Category','c'); $s->AddSelect(array('Name', 'CategoryID', 'Priority'), 'c');
    it works as it should work.

    I don't understand that this extension did work as it should for other people.
Sign In or Register to comment.