Recent searches


No recent searches

Restrict end users from posting to certain topics

Answered


image avatar

Mike Davis

Zendesk LuminaryUser Group Leader

Posted Mar 29, 2022

Hi all!

I'm struggling to find out if it is possible, and if so, how to restrict end users of your community from posting to certain topics. For example, we have a topic is setup to be visible to signed-in users. The topic is also set to allow agents and admins to manage it. However, while I want end users to see it when signed in, I don't want then to be able to choose it when creating a post themselves. Is there way to prevent that using segments today and have I missed it? Open to suggestions on how to achieve this. Thanks!


0

12

12 comments

image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi Mike Davis,  I think you should try once to choose the signed-in users option,

 

 

0


image avatar

Mike Davis

Zendesk LuminaryUser Group Leader

Hi Ifra Saqlain! Thanks for the follow-up. So my setup today is that User segment is set to Signed-in users and Who can manage posts? is set to Agents and Admins. I can't seem to prevent a signed-in end user from picking this topic when creating a post, however.

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Mike Davis, you can hide the topic from the dropdown list on new_post_page. See what I did:-

 

Template Name: new_community_post_page.hbs

 

 

I'm hiding the topic in the dropdown for the signed-in users, they can see the topic on topic-list-template but when they couldn't make a post under this topic.

 

 

Code:  Add the below code at the bottom

{{#if signed_in}}
<style>
  .nesty-panel li:nth-child(3) {
  display: none !important;
}
</style>
{{/if}}


Note: :nth-child(3), you can change the topic number which you want to hide in the dropdown -->



Screenshot:




 

Let me know if solves your query :)

Thanks

0


image avatar

Mike Davis

Zendesk LuminaryUser Group Leader

Thanks for the hack, Ifra! I'll work with our team to see if that indeed solves our conundrum. Many thanks for the help.

0


I got this to work, however, when you open the relevant topic page, there is a 'New post' button. When you click the button, the topic is displayed, by default, in the topic box, but disappears when you drop down the topics. It seems that if you do not drop down the topics, you can post to the relevant topic.

Is it possible to also disable or hide the New Post button for a particular topic?

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi fkrugerx,

Do the following:-

i). On preview mode, click the topic you want to hide the 'New post' button for that.

ii). You will redirect to that topic page and then copy the topic ID from the search-bar.

 

 

iii). Check the topic ID on 'community_topic_page.hbs' file. See the given screenshot of how I did.

 

 

 

iv). Replace '000000000' with your topic ID which you have copied from the searchbar.

 

 

v). When you have done, preview and test, and if any issues let me know.

 

 

Thanks

Team

 

 

0


Hi Ifra Saqlain - How would I hide multiple topics using this code? I was able to hide the button from 1 topic as shown above, but not sure how to list multiple topics to hide the post button from.

 

Thanks,

Melissa

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi Melissa Lucore, I tried for multiple IDs and got the solution:-

   
    {{#isnt topic.id 000000000}} For First topic ID
   {{#isnt topic.id 11111111}} For second topic ID
  {{#isnt topic.id 22222222}} For third topic ID
    
      <span class="post-to-community">
      {{link 'new_post' topic_id=topic.id class='button button-large'}}
    </span>
    
     {{/isnt}}
    {{/isnt}}
    {{/isnt}}

 

If any query feel free to ask :)

 

1


Hi Ifra Saqlain, your contributions around the community are always very helpful, and this one is no different. Thank you for being a great contributor.

I do have a question. In my case, it looks like {{#if signed_in}} applies the condition to Admins as well it hides the topics in the .nesty-panel, thus blocking us admins from posting in those topics.

Do you have a suggestion to make all topics available in the .nesty_panel for Admins regardless of any restrictions for end-users? I'm using theme version 1.0.0 with jQuery. Thanks in advance.

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hey Ivan, thanks for the 

your contributions around the community are always very helpful, and this one is no different. Thank you for being a great contributor.

 

,

you can set User Segment for the topic visibility.

 

Go to the Arrange topics:

 

And select that topic which you wanna hide from end-users:

 

 

Let me know if it solves your query :)

 

0


Thanks, Ifra Saqlain We are getting odd behavior. We have 4 topics and we are looking to accomplish the following for each topic.

  • Topic 1 - Public topic. Everyone is able to see and post.
  • Topic 2 - Visible to everyone, but only Admins and agents can post in this topic, not end-users. This is where the .nesty-panel li:nth-child(#) styling is helpful.
  • Topic 3 - Visible to a user segment only. Only admins can post in this topic, end users cannot post here.
  • Topic 4 - Visible to a user segment only who can view and post. Admins can post here as well.

The Who can manage posts setting is set to Agents and admins for all topics. Yet, when the .nesty-panel li:nth-child(#) styling is applied to topics 2 and 3, it removes topics 2 and 4 from the list for admins.

I'm not good with code at all, everything I've done has been by following suggestions in this community. But I'm wondering if a condition that states "Unless the user is an admin, users cannot post in topics 2 and 3" would be better in my case.

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hey Ivan,

You can try the followings, (Not tested):

i). Go to the new_community_post_page.hbs file and paste the given code at the bottom.

<style>
  .form-field .nesty-input{display:none}
  #community_post_topic_id{display:block !important}
</style>

 

ii). Go to the script.js file and paste the given code at the bottom.

$(document).ready(function(){ 
if(HelpCenter.user.role == 'end_user' || HelpCenter.user.role == 'anonymous' ) {
      $('#community_post_topic_id option:nth-child(3) , #community_post_topic_id option:nth-child(4)').hide();
    }
});

 

Try this and let me know.

Thanks

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post