The big changes in this release are adding an option to sync Discourse topics to their associated WordPress posts with a webhook, and adding support for connecting a single Discourse forum to a WordPress multisite network. Check out the Webhook Settings and Multisite Support sections of the WP Discourse installation and setup topic for details about both of these features.
Other changes include:
adding a featured_link option to the Publish options - thanks @iamntz! I’m finding this works very well with a customized publish_format_html template that removes the {blog_url} template tag.
adding an option to not display the Discourse Name field on the WordPress user’s profile page. Enabling this will cause all posts to be published by the name supplied in the publishing_username field.
removing the debug_mode option and adding a wpdc_comment_sync_period filter that can be used in its place. The problem with the debug_mode option was that if it was left checked by mistake, it would have a huge impact on the plugin’s performance. If people are missing this option, it could be added back, but changed so that it’s only enabled for a single request.
Comment sync period filter example
Unless you are using a webhook to sync comments, the plugin defaults to syncing comments every 10 minutes. To change the sync period, you can do something like this:
// Sync comments once every hour.
add_filter( 'wpdc_comment_sync_period', 'my_namespace_sync_period' );
function my_namespace_sync_period( $sync_period ) {
return 60 * 60; // 60 seconds * 60 minutes.
}
Coming Soon
a webhook option to automatically populate the Discourse Name field with the Discourse username. This will be able to be used when WordPress is the SSO provider for your forum, or when, through some other login system, you can guarantee that the user credentials on Discourse and WordPress match.
WP Discourse version 1.4.15 is now in the WordPress plugin repo. The biggest change is that there is now a network options page for multisite installations. It can be accessed through the Dashboard of the Network Admin section on multisite installations. If you enable the Multisite Configuration option on that page, you can set some options for all sites on the network. The Multisite Configuration option is only to be used for the case of a single Discourse forum connecting to a network of WordPress sites.
If you have enabled the Multisite Configuration option in version 1.4.0 of the plugin, the site options should be automatically transferred to the new options page.
Using WordPress as either the SSO Provider or the SSO Client is now possible when the Multisite Configuration option is enabled.
For single and multisite installations, an Update Userdata webhook endpoint has been added. Out of the box, it is only active for sites that are using WordPress as the SSO provider for Discourse. It is useful for automatically populating the Discourse Username field on the WordPress user’s profile when a user is first created on Discourse. If you have a reason to use this webhook without enabling SSO, that can be done by hooking a function into the wpdc_use_discourse_user_webhook filter.
Todo:
add a non-webhook option for syncing user data
rework the email verification system for multisite setups - with the default WordPress multisite setup, user’s email addresses are being verified by WordPress, but they are still having to reverify them when they login to Discourse for the first time.
Version 1.4.2 is a minor update that fixes a bug with the auto-login SSO feature. If that feature is enabled, the plugin now checks its connection status with Discourse before attempting to log the user into Discourse.
It also allows a skip_autologin query parameter to be added to the WordPress login URL. This is useful if SSO between WordPress and Discourse is misconfigured and you need to login to your WordPress site. You can do it with a URL like this:
You should stick to semantic versioning. The “1.4.15” release should’ve just been the “1.4.2” release, no matter how small the patch may be. Otherwise you mess with GitHub’s releases chronology and potentially other stuff.
After upgrading to 1.4.2, the Multisite Configuration option no longer appears in the Connection Settings on my main site. Did this functionality change intentionally between 1.4.0 and .2, or is something amiss on my install?
Did you see a notice telling you that the plugin’s network settings have been transferred to the Network Admin dashboard? It would only appear for you if you had enabled the Multisite Configuration option in version 1.4.0.
The network admin options for the plugin can now be found at Network Admin/Dashboard/Discourse. Let me know if you have any problems with this.
Any plans to also implement this the other way around?
I’d really want to use Discourse as SSO provider, while also keeping the userdata in sync
Specific usecases:
changing name in discourse should change name in wordpress
deleting a user in discourse should remove the user from wordpress (or disable the account)
We use usermanagement to restrict access to the site and forum, so deleting/anonymising a forum-user should really result in them losing access to the site as well.
The WordPress username isn’t editable, but changing the Discourse username does update the Discourse Name on WordPress when Discourse is used as the SSO provider. I should make that clear in the documentation.
The Discourse user webhook isn’t sent when an account is deleted, so this isn’t going to work. If Discourse plugin was created that would send a request to WordPress when an account was deleted, then it would be easy to delete the user on the WordPress end.
I’ll see if I can think of a way of handling the whole process from the WordPress end.
Thanks for reaching out! At the moment it doesn’t seem to change the Discourse name.
That said, my setup at the moment is a bit flaky (running on IP addresses only); I should have a more solid system in place this afternoon and I’ll let you know
WP Discourse version 1.4.5 is now in the WordPress repo. It has a few small changes:
When posts are updated on WordPress, they are no longer automatically republished to Discourse. To republish the post, select the Update Discourse topic checkbox in the Publish to Discourse meta-box.
An option to open the Start Discussion and Continue Discussion links in a new tab has been added. You can find it on the plugin’s Commenting settings tab.
A wpds_sync_discourse_comments action has been added. Calling do_action( 'wpdc_sync_discourse_comments', $post_id )
will call the WP Discourse sync_comments function for $post_id. It was added to make it possible to use the plugin with the Timber theme, but could have other uses. See WP Discourse Plugin Tips and Tricks for details.