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.
1 Like
As a workaround, you can hide these buttons with CSS:
section.controls > ul > li > button.compose-pm, section.controls > ul > li.chat-button {
display: none !important;
}
You can put this code under the ‘Mobile’ tab in the ‘Edit CSS/HTML’ screen in a new theme/component (tick the ‘Show Advanced checkbox’).
1 Like
Much better! Thank for the CSS code – works like a charm and I can’t couldn’t have figure it out myself 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
@donaldsoncd Hmm… maybe there is a way to do this. I’ll take a look.
1 Like
@donaldsoncd Try adding this bit to the JS tab. It’ll only hide the buttons on your user pages. The buttons still show on the user card.
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";
}
}
});
});
It’s a bit hacky but gets the job done.
You can replace the part /u/natedhaliwal
with /u/<username>
.
If you want to completely remove the ability for anyone to PM or chat with you, you’ll need to:
Go to discourse.example.com/my/preferences/users
.
Uncheck the checkbox Allow other users to send me personal messages and chat direct messages
.
Hope all that helps!
chapoi
(Charlie)
August 25, 2025, 10:07am
8
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!
3 Likes