Send every new community post to a specific topic and remove the new post topic drop-down menu

回答済み

11 コメント

  • Kasper Sørensen
    Zendesk Product Manager

    Hi Richard Barrett,

    You will have to do a bit of heavy handed theme customisation to achieve this. So it assumes some basic HTML knowledge and that you're comfortable editing your theme's code in Guide Admin.

    I'm gonna look at the case of making the "New post" page always submit posts to the same topic first. I think that once you understand how that is done, then the rest becomes simple.

    So in the theme editor, open the file new_community_post_page.hbs in the theme editor. Locate the snippet that inserts the topic selector. It has something like "{{select 'topic'}}" in it. This whole section of the template you will want to replace with a hidden topic selector:

    <input type="hidden" name="community_post[topic_id]" value="TOPIC_ID" />

    Where TOPIC id is replaced by the ID of your topic. You can find that ID simply by going to the topic and copying the long number out of the URL :-)

     

    0
  • Richard Barrett

    Kasper Sørensen I'm comfortable editing the theme's code in Guide admin and thank you very much for your help. you saved me a lot of time.

    0
  • Matt Foley

    Hi Kasper Sørensen, I followed your recommendation to this helpful post.

    Would you have a similar recommendation for the community_topic_page.hbs?

    It would be greatly appreciated!

    0
  • Ifra Saqlain
    Community Moderator

    @Matt, can you explain what do want to do ? Do want to do same thing?

    0
  • Matt Foley

    Hi Ifra!

    I was hoping to utilize/repurpose this HTML string to hide the New Post button on a particular topic page using the Topic ID.

    We have a Blog topic that I don't want users to be able to post on.

    0
  • Ifra Saqlain
    Community Moderator

    Okay, I'll get back to you.

    0
  • Matt Foley

    Hi Ifra! Were you able to find a solution to this?

     

    Thanks!

    0
  • Ifra Saqlain
    Community Moderator

    Hey Matt,

    I was busy in the project so I couldn't come back. Now you can do this for hiding new post button on specific topic page. Just copy this code and replace with your own new_post button on topic page. Pay attention on the class names. 

     {{#isnt topic.id 1234567889}}   // These given numbers are topic ID so you need to update this
    <span class="post-to-community">
    {{link 'new_post' topic_id=topic.id class='button button-large'}}
    </span>
    {{/isnt}}

     

    2
  • Matt Foley

    You are amazing!

    This totally worked and the New Post button is hidden on the desired topic.

    Now I just have to figure out how to remove an option from the Topic Drop Down and I will be set.

    Are there any articles that help hide Topic options on new community posts?

     

    1
  • Richard Barrett

    After returning to the original issue of this post, the answer is surprisingly simple.... wrap a <span> tag around the select tag and hide it using CSS styling. The {{select 'topic'}} code has to be replaced (or commented out, as I prefer to do) with HTML markup copied from the page. For those of you reading this who aren't familiar with how to do that and you're using Chrome browser, browse/preview the new post page, right-click on the select menu and choose "Inspect" from the context menu. When you have found the <select>...</select> tag in the markup window, right-click on it and choose to "Copy outerHTML". Et voilà. Make sure to only keep the option containing the page id value and remove any others (there's a blank option tag in there, you don't need to keep that) Here's my solution ...

    {{!-- 

    {{label 'topic'}}
    {{select 'topic'}}

    --}}


    <span style="visibility: hidden; display: none;">
    <select name="community_post[topic_id]" id="community_post_topic_id" aria-required="false">
    <option value="360001623552">Feature Requests</option>
    </select>
    </span>

     

    0
  • Nicole S.
    Zendesk Community Team

    Thanks so much for sharing your knowledge, Richard!

    We'd love it if you'd consider re-posting it as a User Tip as well.

    0

サインインしてコメントを残してください。

Powered by Zendesk