Summary:
Give users each a specific Homepage (âHome Categoryâ) in your community.
It allows you to have a single Discourse in which users have specific âhome pagesâ (read: Category) as determined by their Primary Group.
GitHub: Repository https://github.com/merefield/discourse-category-home
Install: Follow the plugin installation guide.
Enjoying this plugin? Please it on GitHub !
Features
Using only the available interface elements of a normal Discourse, makes this a robust, easy-to-maintain solution.
Configuration
Using normal Discourse functionality:
- Decide how many Category âhomesâ you want, create them if they donât exist:
- Unless they already exist, create a distinct Group for each of them
- Add the Users to each of those Groups appropriately
- Set that Group as each Userâs Primary Group
- Permission each of those Groups to its respective Category.
You are DONE!
Now whenever someone navigates to your community Homepage, they will be redirected to the Category for which their Primary Group is permissioned.
NB: This follows a simple rule you must stick to: If someone has a Primary Group registered and that is permissioned to a single Category, it will redirect to that Category as their home.
Using a Primary Group in this way has a number of advantages, as you may have noticed from the link above, not least:
- You can give someone a Title
- You can give them a Flair
- You can style their Posts
Other considerations
Make your Category Homepages more impactful by styling them distinctly, with e.g.: Category Banners
Checking distinct Category/Primary Group Permissions
To check your Primary Group is only associated with a single Category, you can use this handy out-of-the-box feature of Discourse, e.g.:
There is but one Category in the list, good!
The Technical Bit
The exact logic employed is this:
return CategoryGroup.where(group_id: primary_group).first.category_id
Whilst it might be possible to âfudgeâ it, it is probably unwise if you use that Primary Group on more than one Category if you expect this to work, so bear that in mind and keep to my recommendation.
Providing more flexibility
Iâm open to suggestions on how else to configure this behaviour but Iâd like to limit the amount of bespoke settings and use as much out of the box behaviour and data as possible. If you have a simple, elegant solution in mind let me know.
Canât install plugins/Primary Group thing doesnât work for you?
If you canât install Plugins (because you are on a restrictive hosting plan), or find the Primary Group configuration doesnât work for you, consider this Theme Component alternative: Custom Homepage for Groups which requires more bespoke configuration, but is less invasive.