Prevent users from posting in community topic? | Community
Skip to main content

Prevent users from posting in community topic?

  • September 12, 2019
  • 10 replies
  • 0 views

Is there a way to prevent end-users from posting in a certain community topic?  We're trying to create an announcement type of topic where only managers/agents could create a new post.  We can already lock existing posts, but we can't create random users from making new posts.

10 replies

Nicole17
  • September 13, 2019

Hey Dylan .- 

There's no way to do this out of the box, though I know some users have implemented custom code to his the "new post" button from within certain topics. If you're interested in that, we can see if any of our community moderators or other members can help you out with the customization. 


  • Author
  • September 20, 2019

That's what I figured.  I think we'll just post in the KB for those situations and avoid the forums.  Thanks.


Nicole17
  • September 20, 2019

You're welcome. Sorry I don't have a more straightforward answer for you on that one. 

You may want to post a request for that kind of functionality in the Gather Product Feedback topic - I suspect there are a number of users who would like to be able to do the same. 


  • January 9, 2020

Hey Nicole, we would like to prevent community users from creating new posts. They should be able to comment on existing posts though. How can we do that? Could you help us with the code? Thanks!


  • January 9, 2020

Hi Florian,

You can comment out the new_post code in the various community pages. For example, in the community_topic_page.hbs, search for new_post and there are two different blocks of code that include new_post. They look like this:

<span class="post-to-community">
{{link 'new_post' role='button' topic_id=topic.id class='button button-large'}}
</span>

<h2 class="community-footer-title">{{t 'suggest_new_post'}}</h2>
{{link 'new_post' role='button' class='button-large'}}

You can then comment out these pieces of code. It will look like this:

<!-- <span class="post-to-community">
{{link 'new_post' role='button' topic_id=topic.id class='button button-large'}}
</span> -->

<!-- <h2 class="community-footer-title">{{t 'suggest_new_post'}}</h2>
{{link 'new_post' role='button' class='button-large'}} -->

Do that for all the community pages and the New Post button won't display on those pages anymore. 

Hope that helps!

Thanks,

Maggie

 

 


  • January 9, 2020

Thanks Maggie!

It worked for me on community_post_page.hbs and community_topic_page.hbs

but did not work on community_post_list_page.hbs and community_topic_list_page.hbs where I'm always getting the error:

1 error
not possible to access `topic` in `topic.id`
 
Please advise. Thank you!

  • January 9, 2020

Hi,

Your commented out code on community_post_list_page.hbs should look like this:

<!--<span class="post-to-community">
{{link 'new_post' role='button' class='button-large'}}
</span>-->

<section class="container community-footer">
<!-- <h2 class="community-footer-title">{{t 'suggest_new_post'}}</h2>
{{link 'new_post' role='button' class='button-large'}}
</section>
</div> -->

And on community_topic_list_page.hbs:

<!-- <span class="post-to-community">
{{link 'new_post' role='button' class='button-large'}}
</span> -->

<!-- <h2 class="community-footer-title">{{t 'suggest_new_post'}}</h2>
{{link 'new_post' role='button' class='button-large'}}
</section>
</div> -->

Hopefully that will fix the error for you.

Thanks!

Maggie

 


  • January 9, 2020

It did! Thank you! :-)


  • January 28, 2021

Hello, 

Thanks for the help here.. 

We wanted to prevent posting but on a specific topic not all. So we combined your proposal with 

{{#is topic.id xxxxxx}}{{else}}
{{link 'new_post' role='button' class='button-large'}}
{{/is}}

To only removing "POST" button an a single topic. 

Now we are looking for a way to also remove this capabilities from the general "/community/posts/new" Topic choice in the dropdown of the form.
Any suggestion ?

Regards

Pierre-Mikael 


  • October 21, 2021

I will also echo the need for restricting post abilities to certain user segments. We would only like our internal employees to be able to post to Announcments, not end users. If we completely remove the new post button, no one can make a post. 

 

Any update on this or is there anyway we can make a formal request for this functionality?