Default Composer Category component

Repository at GitHub - discourse/discourse-default-composer-category

https://github.com/pmusaraj/discourse-default-composer-category

Install this theme component

What this does?

This is a very simple theme component that does only one thing: it lets administrators set a category as the default category for the composer. It’s most useful for sites that have disabled the Uncategorized category and would like another category to be automatically selected when launching the composer.

How to configure it

The configuration asks for the category id for the default category.

You can find out the id for the category by navigating to the category page for that category and taking the last number in the URL, e.g. /c/site-feedback/2 → 2.

24 Likes

Great component, thank you!

One issue I have though is that for the category I selected I have set Minimum number of tags required in a topic to one. Still it lets me create a topic without adding a tag.

2 Likes

Thanks for the bug report @tpetrov, it should now be fixed via:

https://github.com/pmusaraj/discourse-default-composer-category/commit/aa30def362501f67ae06541ae62597a32bae8ac7

5 Likes

Wow, that was real quick. Thanks a bunch!!

2 Likes

I’ve just noticed this. This is fantastic.

Here’s my vote for disabling uncategorized by default and moving this to core.

6 Likes

Hey @pmusaraj, I just installed this component on my forum and wondering if you could clarify the set-up for me. It’s not clear what format the “default composer category id” should be in – I tried the name of the category and also the URL, and neither seem to work.

What ID should I be using?

1 Like

I would try 22.

4 Likes

Thanks, @Moin, that fixed it.

3 Likes

I would love to have the ability to assign a default default category, but then allow users to select their preferred personal default individually. Has anyone else had this thought, or have ideas on how to do it?

3 Likes

I would love this too. I think uncategorized, the un-category is very confusing. I was hoping that new new General was going to be a default category to replace Uncategorized rather than an oddly named replacement for lounge.

4 Likes

I believe it will be soon. :slightly_smiling_face:

3 Likes

This is a very fresh change and was just merged in. General is now the default category in the composer on NEW sites.

This doesn’t exist yet, but I’m open to adding it!

For existing sites I’ll have to come up with a plan on how they can get the default category feature. Right now it requires disabling the allow_uncategorized_topics, but then it will also require that the General category exists and that the hidden site setting general_category_id is set, but if admins could customize which category was the default this would make it easier for existing sites to get this functionality and possibly get it to work with uncategorized enabled still.

3 Likes

Oh! Hooray! That’s what I’d originally thought. I’m :man_dancing: that this is what happened.

Yeah. That is rather complicated, but I don’t see an easy way around it.

. . . wait

Wait. Wait! Wait!!! Why is that hidden? :confused: Why not just let people choose any old category as the default from a category pulldown? Why did we call it general_category_id rather than default_category_id? It wouldn’t be a big deal to switch to this much-much-much better solution if you could just select any category as the default.

5 Likes

Totally agree that this would be better as a setting in the UI, and that default is a better term

5 Likes

I think #general makes sense for

  • many smaller sites, especially those where the overall focus of discussion is narrow
  • sites that haven’t put a lot of work into thinking about categories [1]

I won’t claim my sites are huge, but #general wouldn’t really work.

To make this all concrete, in case this helps:

Currently, we have two sites, end-user-support-focused Ask Fedora and project-mainatainer/contributor-focused Fedora Discussion. After running with that split for several years, we’ve decided to merge Ask into being a sub-category of Discussion.

Based on experience, we definitely want the default category for new users to be Ask Fedora. Otherwise, chaos ensues. But, people who are more involved in the contributor side are likely to want the Project Discussions category (the current default on Discussion) to be that default. It’d be nice to present this as an easy option.

(Let me know if I should split this into its own topic or make a ticket somewhere…)


  1. admittedly, most sites in my experience *sigh* ↩︎

3 Likes

But won’t it work as well as Uncategorized ?

Unless moderators are really aggressive about sorting those after they come in, that might as well be #trashcan. Who is going to subscribe to to that category?

The same people who subscribed to Uncategorized ?

But I may have missed some piece of your argument. I think that this theme component is a great idea. I also think that getting rid of Uncategorized is a great idea (which is what I’m talking about, and I am now sensing that this is not what you are talking about).

The issue is the overhead of forcing people to select a category. I think that you and I agree that it’s not that hard (if there are few enough to choose among).

1 Like

Yes, I think we’re in basic agreement. I don’t allow allow uncategorized posts — and a defined default (whether via this component or built in) seems better in every way — at least as long as the name is configurable.

And as an extra request I’d like the option to allow users to select their own default.

1 Like

It would be nice if you could set a different default category in composer based on the groups the member is in.

I’m hoping to run multiple independent communities as separate groups with private categories on one Discourse server and would like to keep them pretty much isolated from each other.

At present when posting they have to select a category. That’s not all that bad a thing, it just would be a little more convenient if I could suggest a default based on what group they’re in.

They’re not secret groups, most members know I run multiple discussion groups, they just choose which one they’re interested in.

Similarly, it would be helpful if new users could request a group when signing up. You can place them into a group with an invite, seems like it would be useful to allow them to choose one as well, though maybe that creates issues that would require allowing private-but-selectable and private-but-mostly-secret groups

3 Likes