• Resolved kennyswift

    (@kennyswift)


    I need to create a group (a university class) and have them post in one category only (or 2, perhaps). So I’d like to set a post category for each group. Those categories may then be public, no need to restrict reading access.

    Is there a way to do it with the core plugin, or by using the Groups Restrict Categories add-on? From what I understand, the latter is only for hiding categories to certain user groups.

    • This topic was modified 1 year, 2 months ago by kennyswift.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kento

    (@proaktion)

    Hi!

    Thanks for posting this, it’s a case that isn’t covered yet OOTB by Groups or any of its extensions.

    One approach you could take is to limit the categories offered when someone is editing a post based on their group membership. You’d have to use a filter to limit the categories offered, and could use Groups’ API to check for the user’s membership.

    For example, use the list_terms_exclusions filter hook and exclude categories that the user should not be able to choose while editing a post. On the Examples documentation page you can see how to check for a user’s membership. Also useful as a source are the repositories related to Groups.

    I hope this helps, feel free to ask if you have any questions!

    Thread Starter kennyswift

    (@kennyswift)

    Hi Kento, thanks for the quick response! I will look into it.

    For my needs it would be ideal if list_terms_exclusions could exclude every category except for the one that’s specifically requested by the admin.

    Plugin Author Kento

    (@proaktion)

    Great, it would be interesting to see the solution when you’ve had a chance to look into it. I guess the block editor’s categories meta box could be affected by the filter, but I wonder if there’s another way to achieve what you need hooking into anything that the block editor provides.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Restrict group to posting in specific categories’ is closed to new replies.