Skip to main content
Solved

Can you disable Create Post in Groups?


Is there a way to disable the Create Post function in Groups? I see the ability to disable comments on articles posted in there, though a client is wondering for their use case, if members of their group can be prevented from creating posts in there.

Best answer by ravi.kurma

Hi @Erwin Tuazon!

The solutions @SmartlyGreg posted are great! You can also simply remove the button with custom CSS. 

  1. To open up Custom CSS, please click on Theme once you are logged in as admin and click on Custom CSS
  1. You will get a section on the right hand side to enter in custom code, use the following snippet. 
    .group-details_hero__user-actions .create-group-topic-btn {
        display: none;
    }

     

Hopefully this helped!

Sincerely,

Ravi

View original
Did you find this topic helpful?

4 replies

SmartlyGreg
Forum|alt.badge.img
  • Helper ⭐️⭐️⭐️
  • 201 replies
  • January 4, 2022

@Erwin Tuazon I couldn’t find a way to do this from Control, I think the idea is you are either part of the group or not, no “observers” so to speak.

 

If you choose to go down the route of custom script you can:

 

  1. Remove the dropdown for that group within the new topic page:

You could however do a bit of coding to achieve this such as:

<script>
if (inSidedData.page.url.includes("/topic/new")) {
  document.onclick= function(event) {
    if (event===undefined) event= window.event;
      		for (let i = 0; i < document.getElementsByClassName("optgroup").length; i++) {
        		for (let j = 0; j < document.getElementsByClassName("optgroup")[i].children.length; j++) {
                  var categoryTitle = document.getElementsByClassName("optgroup")[i].children[j];
        				if (categoryTitle.innerText === "CATEGORY/ GROUP TO REMOVE HERE") {
            				categoryTitle.classList.add("dont-show");
            			}
       			 }
      		}
  };
}
</script>

With Custom CSS:

.dont-show {
  display:none;
}

 

But you might want to select which custom roles can and cannot post in that specific category or group so adding the following around your script to select what role to execute this for:

<script>
if (inSidedData.user.role == 'CUSTOM ROLE NAME HERE') {
  // INSERT SCRIPT TO EXECUTE HERE
}
</script>

 

  1. Remove the Create Topic button from a given group

Simply using this short script to assign the same CSS class listed above

<script>
if (inSidedData.page.url.includes("groups/END OF GROUP URL")) {  
  var groupCreateTopic = document.getElementsByClassName("create-group-topic-btn")[0];
  groupCreateTopic.classList.add("dont-show");
}  
</script>

 

Note: I encountered some difficulty due to the list of categories being generated each time it is open, so the entire script above is triggered each time a user clicks somewhere on the new topic page… There might be a better way to do this but this works nicely if you need it!

 

Hope this helps!


ravi.kurma
  • Helper ⭐️⭐️⭐️
  • 76 replies
  • Answer
  • January 4, 2022

Hi @Erwin Tuazon!

The solutions @SmartlyGreg posted are great! You can also simply remove the button with custom CSS. 

  1. To open up Custom CSS, please click on Theme once you are logged in as admin and click on Custom CSS
  1. You will get a section on the right hand side to enter in custom code, use the following snippet. 
    .group-details_hero__user-actions .create-group-topic-btn {
        display: none;
    }

     

Hopefully this helped!

Sincerely,

Ravi


  • Author
  • Contributor ⭐️
  • 2 replies
  • January 4, 2022

Thank you @SmartlyGreg​​​​​@ravi.kurma! I’ll try this and let you know.


SmartlyGreg
Forum|alt.badge.img
  • Helper ⭐️⭐️⭐️
  • 201 replies
  • January 4, 2022

@ravi.kurma  thanks. I admit my assumption was that the goal was to do so for a specific group only… For all groips the css only method is indeed much clesner.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings