Send every new community post to a specific topic and remove the new post topic drop-down menu
답변함I only have only two community topics. One topic is for user-generated product Feature Requests and the other is a Roadmap that only lists feature requests tagged (planned, in progress, completed) by a manager user. End-users will not be able to post to the Roadmap topic and I plan to hide the 'New Post' button from that community topic page. With all this in mind, I need to remove the *required topic drop-down menu from the new community post page and send all new posts to the Feature Requests topic. How does one achieve these two things?
-
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}} -
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?
-
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 :-)
-
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.
-
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!
-
@Matt, can you explain what do want to do ? Do want to do same thing?
-
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.
-
Okay, I'll get back to you.
-
Hi Ifra! Were you able to find a solution to this?
Thanks!
-
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> -
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.
댓글을 남기려면 로그인하세요.
11 댓글