Hey Daniel -
You can add a third party script to achieve this.
Here is example code:
<script>
document.addEventListener('DOMContentLoaded', function () {
console.log('Document is ready.');
// Ensure the inSidedData object exists
if (window.inSidedData && window.inSidedData.user && window.inSidedData.user.role) {
console.log('inSidedData object found:', window.inSidedData.user.role);
// Check if the user role includes "Chat Beta"
if (window.inSidedData.user.role.includes('Chat Beta')) {
console.log('User has the Chat Beta role.');
// Observe DOM changes to detect when the "Create topic" element is added
const observer = new MutationObserver(function (mutationsList) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
const createTopicElement = document.querySelector(
'li.is-hidden-S a.menu-create-topic.qa-menu-create-topic[title="Create topic"]'
);
if (createTopicElement) {
console.log('Create topic element found via MutationObserver:', createTopicElement);
createTopicElement.parentElement.style.display = 'none';
console.log('Create topic element hidden.');
// Stop observing once the element is found
observer.disconnect();
break;
}
}
}
});
// Start observing the body for added nodes
observer.observe(document.body, { childList: true, subtree: true });
} else {
console.log('User does not have the Chat Beta role.');
}
} else {
console.error('inSidedData object or roles not found.');
}
});
</script>
in this case we using the role = “Chat Beta”, so you would have to change it based on your role.
Thanks,
Anthony