CSS to hide the Activity or Messages tabs on the group detail page

Update 2018-11-30: The CSS to hide the Activity and Messages tabs is here.

tl;dr – what CSS can I use to remove the Activity and Messages tabs on a group detail page (e.g., … /groups/YourGroupName/)?


My question was already asked in July 2017 here and didn’t get a response. So I’m asking in a different category and with different eyeballs available.

Sam told me it was possible to hide the Activity and Messages tabs on the group detail page. As it is, the Activity tab in each group shows the general forum activity for all members in the group – which is really confusing to people who are used to Facebook groups and just generally counter-intuitive to many of our community members.

Since we have direct messaging to groups turned off for all our groups, the presence of the Messages tab also is a distraction for us.

What’s the CSS code to hide the Activity and Messages tabs in the screen shot above?

You also get bonus points if you know how to hide certain columns like Posted and Seen on the Members tab of the groups detail page (e.g., found at … /groups/YourGroupName/).

Thanks in advance for the help, wonderful Discourse folks!

It’s a bit clunky, but something like:

div.container.group.YourGroupNameSlug > div.list-controls > div.container > ul >  li {
     a.messages.ember-view, a.activity.ember-view {
        visibility: hidden; 
     }
}

Should work, the group slug is specified in line one.

Thanks for the suggestion, Stephen.

I added your CSS in the Common section of the default theme (e.g., … /admin/customize/themes/1/common/scss/edit) and had two different experiences in desktop and mobile view.

The screen shots below show how it worked at least functionally in desktop view and didn’t work so well in mobile view. Is there another way to approach hiding the Activity and Messages elements – preferably for all groups at once instead of new templated lines of CSS for each group?

Desktop View

Mobile View

Try to change

visibility: hidden;

with

display: none;

Thanks for the display: none; tweak, @dax. That helped on desktop view, which now looks like this.

However, mobile view still shows the Activity and Messages options in the drop-down list, and frustratingly, the empty white space that was there before (which must be default theme or environmental related).

Do you know why the CSS would work on desktop view and not mobile view? And do you know if there’s a way to use a wildcard in the CSS to apply the display: none; code to all groups instead of going one-by-one?

Yes, they use separate CSS and different selectors. Lots of styling differs between mobile and desktop view, that’s part of how responsive design works.

If you swap to a mobile view on Chrome and inspect elements you can identify how it changes and produce the mobile-friendly alternative.

FYI everyone. Here’s the CSS to hide the Messages and Activitiy tabs on desktop and mobile view.

Desktop

.activity.ember-view, .messages.ember-view {
    display: none;
}

Mobile

.mobile-nav .activity.ember-view, .mobile-nav .messages.ember-view{
    display: none !important;
}

is there a way to “unhide” from an admin?

for example, I hid messages and activity from everyone using your code, but replicated it with .viewing-self and display: inline-block

so the user them self can see their message box, but unless admins turn off CSS customization, they’re not able to snoop easily.

What I’l looking to do is the opposite of this. I want to hide the profile picture box, or the pencil (change) button from users, but have it visible to admins, without having to go disable the CSS. Any ideas??

특정 페이지에서만 일부 필드를 숨기고 싶습니다. 예를 들어 /messages 페이지에서는 사용자 정보 부분(사용자 이름, 프로필 사진 등)을 숨기고 싶은데요. 나머지 페이지에 영향을 주지 않고 특정 페이지에서만 CSS를 숨기는 방법은 무엇일까요?

HTML에서 더 위쪽을 확인해 보세요. 각 페이지에는 <body> 태그에 추가되는 고유한 클래스가 있습니다.

예를 들어, /messages 페이지에서는 다음과 같은 내용을 볼 수 있습니다.

unique page class in browser inspect tools

이 클래스는 다른 페이지에는 추가되지 않고, 메시징 페이지에만 추가됩니다.

Discourse는 SCSS를 사용합니다. 따라서 다음과 같이 셀렉터를 중첩할 수 있습니다.

// styles for the /messages page
.user-messages-page {
  // hide user avatar/name/username
  .user-profile-names,
  .user-profile-avatar {
    display: none;
  }
}

일반적인 CSS도 작동합니다.