A few enhancements for the wp-discourse plugin

I’ve put a few pull requests into the hopper on github for the wp-discourse plugin that fix a bug and add a couple minor features to the plugin to fit how I want to use it as I have been integrating Discourse into an existing WordPress site that I manage. I thought I would post a little summary about them here.

  1. In the HTML template for each comment there is a comment-meta item that is the datetime for when the comment was posted. That data is supposed to be wrapped with an HTML <time> tag. But that tag is not on WordPress’s global list of allowed tags and so it was getting filtered out of the HTML that was being output on the front end. I just added the <time> tag to the list of allowed tags for the sake of the wp-discourse plugin to fix this. See: https://github.com/discourse/wp-discourse/pull/135

  2. The way the plugin was formatting the datetime from the Discourse comment, it was only using the format string for a date from the WP site’s preferences. So the datetime was only a date (no time). I added a new custom datetime format string to the admin that allows you to format the datetime string however you want, consistent with WordPress datetime formatting options. See: https://github.com/discourse/wp-discourse/pull/136

  3. The last one is my answer to what to do about enabling Discourse comments for existing WP posts/pages that have a lot of valuable pre-existing WP comments on them. It would be nice to be able to cleanly export WP comments into Discourse, but there is no currently existing importer for standard WP comments and there are a lot of edge cases that make developing one too big a chore for me. The current behavior of the wp-discourse plugin makes you choose to either show Discourse comments and hide the old WP comments OR show the WP comments and not show the Discourse comments. This patch lets you enable Discourse comments for existing posts and choose to show the existing WP comments as a “historical archive” beneath the new Discourse comments. See: https://github.com/discourse/wp-discourse/pull/137

11 Likes

And another one - using code from @AdamCapriola, for those using the SSO feature, I added a feature that lets you fill in the logout redirect field in the Discourse admin with a URL that will be handled by the wp-discourse plugin and will automatically log you out of WordPress when you log out of Discourse. Its use is entirely optional - if you don’t put the specific URL into the Discourse admin, then you are not logged out of WordPress (which is the standard behavior of the plugin). See: https://github.com/discourse/wp-discourse/pull/158

5 Likes