If this helps you, here's some code I used on a Flarum instance on which I disabled discussions completely.
I'm not sure if your intent is to remove those from every single page for every single user ? If you want to add some conditions, you could still use the following code as the starting point.
import {extend} from 'flarum/extend';
import app from 'flarum/app';
import IndexPage from 'flarum/components/IndexPage';
import HeaderSecondary from 'flarum/components/HeaderSecondary';
import SessionDropdown from 'flarum/components/SessionDropdown';
import UserPage from 'flarum/components/UserPage';
import SettingsPage from 'flarum/components/SettingsPage';
app.initializers.add('scratchpad', () => {
extend(IndexPage.prototype, 'sidebarItems', function (items) {
if (items.has('newDiscussion')) {
items.remove('newDiscussion');
}
});
extend(IndexPage.prototype, 'navItems', function (items) {
if (items.has('allDiscussions')) {
items.remove('allDiscussions');
}
});
extend(HeaderSecondary.prototype, 'items', function (items) {
if (items.has('search')) {
items.remove('search');
}
if (items.has('notifications')) {
items.remove('notifications');
}
});
extend(SessionDropdown.prototype, 'items', function (items) {
if (items.has('profile')) {
items.remove('profile');
}
});
extend(UserPage.prototype, 'navItems', function (items) {
if (items.has('posts')) {
items.remove('posts');
}
if (items.has('discussions')) {
items.remove('discussions');
}
});
extend(SettingsPage.prototype, 'settingsItems', function (items) {
if (items.has('notifications')) {
items.remove('notifications');
}
if (items.has('privacy')) {
items.remove('privacy');
}
});
});
EDIT: of course, this could also be done with CSS. I preferred the javascript solution because I was certain there would be no way of accessing those elements by mistake via keyboard shortcuts or other things.