Custom Homepage for Groups

Overview

When installed and added to the active theme, this theme component allows setting a user home page according to their primary group. It was written by @pfaffman. See User-specific Discourse home page.

Use-cases:

  1. You have a group of folk only interested in using a small slice of your instance. They want to only see their specific category.
  2. Temporarily redirect a group of your punters to a special event or the like.
  3. Have different landing pages for different groups.

Details

There is a Theme Setting called group page map that allows for multiple entries. Each entry should be of the format group_name:path , where group_name is the group slug (not the group Full Name ) and the path is the desired home page (e.g., “/c/great-category/4”).

Ensure that the target users have the specified group denoted as their primary group and you are away. If the theme setting or the user primary group is changed, a reload will be required to have the change take effect.

An earlier release of this component, which I think no one was using, used a comma ( , ) rather than a colon (:) to separate the group_name and path. Though this still works, support for that format may be removed in the future.

Anonymous (i.e., not logged in) users have a null primary_group_name , but a logged in user will have a primary_group_name of ‘undefined’. To have a different default home page for logged in vs anonymous users, you could set the global default home page to some page encouraging users to log in and use this component to set the home page to, say /latest .

:information_source: The users with a specified group as primary will not be able to reach your ‘normal’ homepage unless you actively provide a way for them to do that.

Known Issues

  1. It doesn’t seem to be able to redirect to a Published Page, giving this error:
    Oops! That page doesn’t exist or is private.
  2. Old group flair images seem to sometimes be lost once this component is activated for that group

Roadmap

  1. Improve explanations within the component
  2. Adding a path back to the ‘normal’ homepage as part of the component.
12 Likes