Aangepaste startpagina voor groepen

Ah! Sorry. I missed that.

Hmm. Yes. I wonder why I removed support for those. I think maybe you can change those in core now?

I’ll see if that’s in core, and if so, remove those settings.

Or maybe something happened in core that broke those changes. I’ll see what I can figure out. . . .

3 likes

I’m still not sure why I deleted support for the default and anon homepages before. I put those back.

Now if there is a custom_default_homepage it uses that unless there is a matching group match. If there’s an anon_page and the user is anonymous, it uses that.

I couldn’t figure out how or when the mobile page should be set (is it for anon users? all users? does it override the default page? the group map?), so I deleted it. If you’re using that mobile page, tell me what you think it should override (I think maybe set it as the default page if they are on mobile, but if there is a group page, then use that? Still not clear what to do for anon vs logged in–I guess there maybe needs to be mobile versions for all of them?).

Here’s the code:

      let url = null;

      if (settings.custom_default_homepage) {
        url = settings.custom_default_homepage.replace(/^\/+/g, "");
      }

      if (user) {
        if (user.primary_group_name && settings.group_page_map) {
          let groupMap = settings.group_page_map.replace(",", ":").split("|");
          const mapEntry = groupMap.find((value) =>
            RegExp(user.primary_group_name).test(value)
          );
          if (mapEntry) {
            url = mapEntry.split(":")[1].replace(/^\/+/g, "");
          }
        }
      } else if (settings.anon_page) {
        url = settings.anon_page.replace(/^\/+/g, "");
      }

And then it changes the homepage only if url has a value.

8 likes

Is dit themaonderdeel bedoeld om iedereen in de groep om te leiden naar de startpagina bij het inloggen of bij het gebruiken van de links? Ik heb het geïnstalleerd en het logo leidt naar de geselecteerde pagina, maar bij het inloggen wordt de gebruiker nog steeds omgeleid naar de standaard /latest pagina. Als dit de inlogomleiding afhandelt, moet ik nog iets verkeerd hebben ingesteld.

Mijn doel is dat alle gebruikers worden opgenomen in een standaardgroep en dat iedereen bij het inloggen wordt omgeleid naar een alternatieve pagina.

It needs to be their Primary group for this TC to kick in. That is by design, so that there is no conflict when a user is a member of more than one group with a redirect.

Our logic at the start was that it only overrides the default homepage - all others (including anon) take precedence.

The classic use case is using the Categories + Latest view on desktop, as this displays as Categories on mobile (which isn’t very useful).

These days, the sidebar makes this unnecessary for most instances, so I think that removing it makes sense. It might catch out some who have been using the TC for a while though.

2 likes

Wordt niveau 0 van vertrouwen beschouwd als een geldige groep? Zou dit de juiste instelling zijn voor de Groepskaart? trust_level_0:/discourse-ai/ai-bot/conversations. Dat is de huidige instelling die ik heb ingesteld.

Nee, de vertrouwensniveau-groepen kunnen niet worden gebruikt omdat ze niet als primair kunnen worden ingesteld.

Je zou dat kunnen omzeilen door de plug-in voor dynamische groepen te gebruiken om een spiegelgroep te maken als dat essentieel voor je is.

3 likes

Heb je geprobeerd om de aangepaste standaard startpagina in te stellen op je AI-botpagina (zodat het de standaard is voor iedereen) en vervolgens de startpagina voor anonieme gebruikers in te stellen op ‘nieuwste’ (om de standaard voor hen te overschrijven)?

1 like

Ah. OK. I think a different version of this got sent in my email notification. I like this answer better. :slight_smile:

2 likes

Thought you would! Still using email notifications?? That is a bit dinosaurish, Jay!

This is unlikely to work as @everyone isn’t a true group and cannot be made primary

2 likes

By “everyone”, I meant “global”, not the pseudo group. I will edit my post so that it is not misleading.

2 likes

I am very old. And besides, I’m logged in to meta for not much more than 10 hours a day, and I don’t want to miss anything!

5 likes

First, thank you everyone for jumping in and helping with this! It is greatly appreciated!

This is a head scratcher for me.

I have installed this plugin without any issues and set trust_level_0 in the settings with make this primary group. All members in site were added to the group. All users show this as the primary group now.

In the Custom Homepage for Groups component settings this is what I have set.

When accessing the page the users in the Community-Core primary group still land on /latest. If I change the Anon Page to something other than /latest when logging in the users will be shown whatever page is shown in that field so that is the redirect that is occurring.

I am using the Canvas Screen theme and changed to the default to test with the same result.

I also disabled all theme components and plugins to see if this helped without success.

I am thinking that there is either I am missing something that may be apparent to others or there may be an issue with the component.

Did you look in the inspector and see the primary group in the body tag?

Jay, really not sure what inspector for this is?

The users show in the group and have the same indicator on their profiles as mine in this image.

When you right click on your site and select inspect you can see what pfaffman is asking for.
For example I see this on my user admin page (/admin/users/{user_id}/{username})


And since this is my account when I right click and select inspect I see

There you can see “testgroup” in the <body>

That is what I meant, but I now remember/see that the component gets the primary group from the user model, not from the CSS.

So, maybe find a user in the admin user route, and add .json to the URL. Then check what their primary group is and search (in the browser) for primary_group: true and check that the name matches exactly the case you used in the theme config.

2 likes

Hi everyone,

Thanks for the clarification. I followed these instructions and used the .json URL to confirm the exact group name.

The primary group name is indeed Community-Core, with the capital letters and hyphen, which is exactly what I have entered in the theme component’s settings.

Unfortunately, it’s still not working. The Anon page redirect is still in effect. So, the issue must be something else.

Can others confirm this works for them?

Do you have any other ideas what I could check?

Nee. Als het naar de anon-pagina gaat en niet naar de “aangepaste standaard startpagina”, dan vindt het de gebruiker niet wanneer het dat doet

      const user = api.getCurrentUser();

Ik weet niet hoe dat kan gebeuren als de gebruiker daadwerkelijk is ingelogd.

Ah, het stelt de gebruiker in de initializer in, dus ik denk dat als je inlogt nadat de site is geladen, deze code mogelijk niet opnieuw wordt uitgevoerd. Heb je geprobeerd de pagina opnieuw te laden?

1 like

Bedankt Jay, ik heb geprobeerd opnieuw te laden. Ik heb talloze aanpassingen geprobeerd aan de URL’s en dergelijke. Het laadt zeker de Anon-pagina. Als ik dat verander, gaat het naar die pagina en toont het ook /latest in de browser-URL.

Ik heb gezocht en ga ervan uit dat er geen andere manier is om simpelweg door te verwijzen. Het was gemakkelijker met PHP-sites. Ik ben nog steeds een beginner met Discourse.

dit is een zeer vreemd randgeval en mogelijk het terrein betreden van het doen van Discourse iets waarvoor het niet is ontworpen.