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.
Using only the available interface elements of a normal Discourse, makes this a robust, easy-to-maintain solution.
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
Make your Category Homepages more impactful by styling them distinctly, with e.g.: Discourse Category Banners
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 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.
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.
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.