Mix of Wordpress blog comments, public and hidden Discourse threads?

I have been searching around, and not being able to find a clear answer to this. (Partly maybe also because I am not so familiar with the Discourse terminology yet). I am assessing usecases in the hope that Discourse can support them.).

(I have seen the terms public/hidden categories as well as public/private forum used - I am not sure what applies here. I have also seen a comment somewhere that the WP-Discourse plugin could not handle a “private forum”. I am not sure if that is needed here - but I just wish to clarify if I can do what I need to).

The use case is that I wish to “unite” users/comments from a closed Discourse community with “outsiders” through WP posts. (First stage this would simply be blog posts. Later, it could probably also be WP posts used in an unrelated membership plugin on the WP site).
But the WP users/comments are outsiders/foreigners to the Discourse insider community.

By using Discourse as comment system, and syncing comments both ways, the idea is to encourage the WP outsiders to get involved. (More likely to participate / get responses when the insiders are active on the same posts).

Q1: The neatest looking would be if the outsiders only see the comments in WP and not the forum thread. Is this possible,and if so, what setting would be required? (What if it is not public/visible - can the plugin still sync comments with it?).

Q2: If this is not possible, I guess the simpler solution is that this “WP forum thread” would be in a category which is public/visible, while the rest of the insider community would be in private/hidden categories - both accessible to the insiders?

(We keep SSO out of the use case for simplicity).

Q3: So the overall question is: How to enable the insiders and outsiders to mingle in that “WP comment zone” - and whether that zone in Discourse needs to be visible in general, or if everything can be closed/hidden, except for the comments synced to the WP post?

This was tricky to write, without fully knowing the vocabulary. I hope it made sense.

4 Likes

Yes, this can be done. As long as you have set an admin API key on the WP Discourse/Connection settings tab, comments from a private forum, or a private category on a public forum, can be displayed on WordPress.

I’m not sure that this answers your question, but it might give you some ideas. I need to write some documentation for what can be done with the Link to Existing Topic functionality. This is a good starting point.

One way to approach this would be to link a WordPress post with an existing Discourse topic. To do this, first, enable the ‘Use Discourse Comments’ setting on WP Discourse (found in the WP Discourse Commenting settings tab.) Then create a post on WordPress that you would like to associate with an existing Discourse topic. In the Discourse meta box for that post, select Link to Existing Topic and enter the URL of the Discourse topic:

Click the Publish button, or the Update button if the post has already been published on WordPress. That will link the posts and allow Discourse comments to be pulled across to WordPress. Unless you want to overwrite the Discourse topic with the WordPress post, don’t ever select the Update Discourse Topic checkbox (I will add a warning to this checkbox.)

You can unlink the post from Discourse at any time by selecting the Unlink Post from Discourse checkbox. You can unlink a post from Discourse and then relink it to a different Discourse topic if you like.

The WP Discourse plugin displays a Join Discussion link at the bottom of the Discourse comments. If you don’t want WordPress users to be able to click through to the Discourse topic, you will need to customize the discourse_no_replies_html and discourse_replies_html templates to remove the link to the Discourse comments. Something like this, added either to your theme’s functions.php file or a plugin would work:

add_filter( 'discourse_no_replies_html', 'wpdc_custom_no_replies_html' );
function wpdc_custom_no_replies_html() {

    return "";
}

add_filter( 'discourse_replies_html', 'wpdc_custom_discourse_replies_html' );
function wpdc_custom_discourse_replies_html() {
    ob_start();
    ?>
    <div id="comments" class="comments-area discourse-comments-area">
        <h2 class="comments-title discourse-comments-title">Notable Replies</h2>
        <ol class="comment-list">{comments}</ol>
        <div class="respond comment-respond">
            <p class="more-replies">{more_replies}</p>
            <div class="comment-reply-title">
                <h4 class="discourse-participants">Participants</h4>
                <p>{participants}</p>
            </div>
        </div>
    </div>
    <?php
    
    return ob_get_clean();
}

That will give you a result like this on WordPress. Ignore the styling on this screenshot, it’s from my development site:

What might work better for your use case would be to have discourse_topic and discourse_post shortcodes that you could embed in a WordPress post. You could then associate the WordPress post with a public Discourse topic while having comments from a private topic Displayed within, or at the bottom of, the WordPress post. The ‘Join Discussion’ link for the post would link to the public topic. Shortcodes for doing this are not yet available in the WP Discourse plugin.

Let me know if any of this isn’t clear, or if I’m misunderstanding what you are trying to do.

3 Likes