"Bericht" en "Chat" knoppen op de eigen profielpagina van de gebruiker

Hello!

On one’s own user (profile) page, there’s are confusing “Message” and “Chat” buttons. On mobile it’s particulary prominent and some of my users (and myself) find it particularly confusing when visiting their user/profile page for the first time.

It appears that this was discussed years ago and a change was supposedly made for the Message button, but I still see it. Maybe this is a bug? Or maybe I have misunderstood the change that was made.

To be more user-friendly, I think it would make sense to remove these buttons from a user’s own user/profile page.

2 likes

Als tijdelijke oplossing kun je deze knoppen verbergen met CSS:

section.controls > ul > li > button.compose-pm, section.controls > ul > li.chat-button {
    display: none !important;
}

Je kunt deze code plaatsen onder het tabblad ‘Mobiel’ op het scherm ‘CSS/HTML bewerken’ in een nieuw thema/component (vink het vakje ‘Toon geavanceerd’ aan).

2 likes

Much better! Thank for the CSS code – works like a charm and I can’t couldn’t have figure it out myself :upside_down_face: I set it for by desktop and mobile.

EDIT: Lol, spoke to soon. The CSS code hides the buttons on all user/profile pages and not just on one’s own page. I might go with it anyways :thinking:

Hmm… misschien is er een manier om dit te doen. Ik zal het bekijken.

1 like

@donaldsoncd Probeer dit toe te voegen aan het JS-tabblad. Het verbergt de knoppen alleen op je gebruikerspagina’s. De knoppen worden nog steeds weergegeven op de gebruikerskaart.

import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
  api.onPageChange((url, title) => {
    if (url.startsWith("/u/natedhaliwal")) {
      const pmBtn = document.querySelector("button.compose-pm");
      pmBtn.style.display = "none";
      const chatBtn = document.querySelector("li.user-card-below-message-button.chat-button");
      if (chatBtn.parentNode.className != "usercard-controls") {
        chatBtn.style.display = "none";
      }
    }
  });
});

Het is een beetje een ‘hacky’ oplossing, maar het doet wat het moet doen.
Je kunt het deel /u/natedhaliwal vervangen door /u/<username>.


Als je de mogelijkheid om privéberichten of chatberichten van anderen volledig wilt verwijderen, moet je het volgende doen:

  1. Ga naar discourse.example.com/my/preferences/users.
  2. Vink het selectievakje Laat andere gebruikers me privéberichten en chatberichten sturen uit.

Hopelijk helpt dit allemaal!

Hey @donaldsoncd

Thanks for bringing that to our attention. I agree that rendering them on your own profile is a bit silly.

I’ve applied a change for that (PR). They should be gone when you update.

Thanks!

4 likes

Much better :slight_smile: Thank you!

1 like