Group and Category customization

(Madhukar Mudunuru) #1

Hi Support,

Please help in achieving the below. I tried using the API but could not find any input params to achieve the below.

  1. Whenever a group created using API, how to set default group config settings like watching/who can see the group etc?
  2. Whenever a category or a subcategory is created from API. How to link that to a group attaching to this category to a group and all members of the group can watch/track respective category.

(Jay Pfaffman) #2

So what you want is to create a category that is accessible only by members of the group? You can do the first part. You can’t (really) solve the watching problem without a plugin that continually makes new members of the group watch the category.

That’s a very common scenario. A script that would do that would be very handy indeed.

(Madhukar Mudunuru) #3

Thanks for the reply Jay. I want the above scenarios to be achieved either by using API or some other mechanism other than doing them manually. To my know knowledge, the current API is not supporting below.

  1. Link category and group
  2. Configure group settings
  3. Create Subcategory
  4. Automatically create category or subcategory while creating the group.

Please throw some light on achieving the above using API or Plugins.

(Stephen Chung) #4

There is a plugin discourse-watch that forces watching by brute force.

Beware, your users might hate you tho.

(Jay Pfaffman) #5

You can do it via a plugin, though last I looked the plugins they exist to do this have no ui, so the plugin needs to be customized for your particular group and category.

I believe that you could do this via the API, though you’d need to use a cron job to update user settings to watch the category.


Link category and group
This can be done - when creating the category you just need to use the key permissions[GROUPNAME] and a value of 1 and it will assign that groupname only to be able to read/write against the category

What group settings are you looking to change?
Watching the group is not part of the standard settings - watching group messages however is.
With regards who can see the group - take a look at the key - group[visibility_level] if you have it set to 0, everyone can see the group, 1 only those members and admins can see the group etc.

Creating a subcategory
When creating a category you need to put in the key parent_category_id and the value of your parent category.

Automatically create category or subcategory while creating the group.
You could do this as part of a script depending on how your coding skills are. You could have it use the API to create the group and then create the category off the back of it (I haven’t got that far yet as still learning the API itself and creating the requests that I need before putting it all together in some orderly script.)

Check out this topic as will help you find your way along -