Custom Homepage for Groups

Thank you once again @Don for your fast support, and @nathank for your input :slight_smile:
The strong support of this community has been all in this path I have been pursuing 2 years now… :')

Both your inputs made me realize of a strategy to solve this apparent sphinx riddle. So I finally got it sorted out this way:

Objective:

  • In desktop, send a user to a custom homepage as per his group.
  • Have the forum icon linking to the categories page.
  • Have a custom header “home” icon linking to the custom homepage.
  • Have the same on mobile, except that the first homepage be the chat room.

Steps:

  1. Disable “force homepage on mobile” in the “Custom Homepage” plugin, and leave only the homepage per group options active.
  2. Change Logo link to redirect to full forum via (thanks @Don!):
  <script type="text/discourse-plugin" version="1.3.0">
   api.changeWidgetSetting('home-logo', 'href', '/categories')
  </script>
  1. Make new header icon link to redirect to custom homepage (use plain forum URL for this effect).

  2. Use this handler in the case the user is on mobile:

  <script>
   if (window.location.pathname == "/")
   { window.location.href = "/chat";
   }
  </script>

This is nice in that a user can change his preference for a custom home that will be obeyed both on desktop and mobile (via the new header icon). I’m forcing chat as homepage for mobile because I assume that it will be the most recurring use-case there.

And thats it! it works like a charm :grin:
Thanks to all of you once again :pray:

2 Likes