I’m working on a wordpress site and have the WP Discourse plugin installed. Our objective is obviously to sync our wordpress site with the Discourse forum so that when a post is published to the site it is also published to Discourse.
However until now it didn’t work much. While creating a post, even with the “Create new Topic” Discourse box checked, it does not work and the post isn’t created in the forum.
I went to the WP Discourse plugin settings and to me everything seemed to be fine (everything isn’t obviously fine and I may have done something wrong as it doesn’t work), the Discourse API key is correct as well as the SSO secret key, as I’m also trying to use my wordpress site as an SSO provider.
I noticed in the WP Discourse plugin settings that there were two error messages, when accessing the “SSO Provider” and “Connection” tabs:
which is quite problematic because there IS an admin user with this email address on the forum (myself).
and most importantly, “You are not connected to Discourse. If you are setting up the plugin, this notice should go away after completing the form on this page.”
Soooo my wordpress and Discourse don’t seem to be synced. Can I please get some help in order to solve this ? Feel free to ask if you need more information - I guess you obviously do
The first thing to sort out is the issue on the Connections tab. The plugin won’t work until you establish a connection with Discourse.
What have you set for the Publishing Username on that tab? It should be set to either the Discourse username of the system user (‘system’ by default) or the username of an admin user from your forum.
So it seems really dumb, but as expected the Publishing Username wasn’t correct (I missed a space on the name). I fixed this and now I have the “You are connected to Discourse!” message.
Also no more error message on the SSO Provider tab. By the way I’m using WordPress 4.9.3.
Anyway, sorry for the inconvenience and thanks again for the answer. I’ll update this thread/create another one if I have any other issue especially with synchronizing the creation of posts between Wordpress and the forum.
For the Publishing Username setting, you need to use the username of your Discourse System user. That username defaults to ‘system’ (without the quotes.) For the API Key, use the All Users API Key. You can find that key at /admin/api/keys.
When I try to visit your site at http://biohackplus.com/, the page isn’t loading for me. Are you able to access it at that URL?
I was able to connect to Discourse. However, although I put all the needed info Publishing tab, when I create a post in Wordpress, it doesn’t show in Discourse.
What I’m trying to do: When I create a post in a category in Wordpress, the plugin will create a post in Discourse with link to my Wordpress post in a matched Discourse Category.
My site has a similar problem. I installed WP Discourse, created an all user key and the publishing username is system. And I still see “You are not connected to Discourse…” My site is proxied by Cloudflare but that is working correctly as far as I can tell. Any help really appreciated. Discourse is 2.6.0.b4.
Hi @angus , thanks for the response. Unfortunately, after creating the single user key as you stated, I still get the no connection message. I’ve tried everything I can think of but no joy…thanks again.
Yes, Global, single user (myself, admin). WP Discourse does not connect.
Discourse hosted by DO
Not sure about custom plugins.
3a. Health Check & Troubleshooting (aka Site Check) has been installed for some time. One questionable “critical issue” reported by Yoast SEO is “Your site cannot be found by search engines.” Further troubleshooting instructions state that “if Google can run the Mobile-Friendly Test, Google can also crawl the domain. In that case, the Ryte warning is wrong.” Both domain and subdomain pass the test.
3b. Tried this previously and once again. All plugins except WP Discourse disabled. WP Discourse does not connect.
UPDATE: I’ve been playing with this for several days and there are several things I don’t understand, probably because almost all of this is totally new to me.
The DNS “A” record for discourse subdomain points to the IP assigned by DO (same IP I use for SSH) but dig discourse.example.com points to three different IP apparently asssigned by Cloudflare and dig https://discourse.example.com points to another IP whois BAREFRUIT-ERRORHANDLING in GB. Something doesn’t smell right here!
I assume WP Discourse uses cURL to connect with Discourse so I have been experimenting with cURL and the Discourse API. I have three API keys (including the key confirmed, above). Until yesterday all three indicated Never Used. Yesterday, I noticed the original key created last August now indicates it was used one day ago! The other two still indicate Never Used. I assume this likely means that one or more of my cURL experiments actually did connect; unfortunately, I don’t know which actually worked. I have also noted that cURL commands that produce http 200 do not change the API Last Used info (remains Never Used).
Both #1 and #2, above, seem important to me but I can’t yet determine the issues.
I apologize for the delay; sometimes life interferes. Again, @angus, thanks for your assist.
Using cURL at my local computer, I also get a 403 so it seems to me this is an upstream issue my site ans WP Discourse. Probably Cloudflare but I don’t want to remove Cloudflare yet. See below.
Another apology for my slowness. I have received a notice from my hosting service that my site is being migrated to another server and there will be some changes, including a change of IP. So I need to delay further work on this problem. May I call on you again when the dust settles?
EDIT: Solved! Perhaps a bug at /admin/site_settings/category/security -> allowed crawler user agents.
It appears that any entry in the allow UA text actually causes a block of all, even a curl command line from my local computer. Resetting the text to empty immediately results in WP Discourse " You are connected to Discourse!
Yes, that setting is intended to be quite restrictive I believe (hence the ALL CAPS warning in the instructions).
To allow your wordpress instance through while using allowed crawler user agents, you can add it like so:
Wordpress/<wordpress_version>
I just tested this out on my test Wordpress / Discourse by adding Wordpress/5.5.3 to allowed crawler user agents and it worked
If you don’t want to keep updating that every time you upgrade your wordpress you can use a simple plugin to set your own user agent for these type of requests in Wordpress, e.g.
Thanks for the explanation. This is starting to make more sense to me. I initially thought “allowed crawler user agents” was meant to identify allowed search engine crawlers. I initially entered “Googlebot” not understanding that WP Discourse used a Wordpress User Agent and became disallowed. Just one more newbie mistake. I should think this is a common misunderstanding but I found nothing in the limited documentation and more limited examples.
As “allowed crawler user agents,” I am now using Wordpress ( version not needed), Googlebot, and Discourse (added for use with cURL as below. Do You see a problem? Or do I need to add others?
Seems similar with cURL using Discourse API. I previously received 403 until I added the user agent as below.
First example published in Discourse API document (doesn't work for me):
curl -X GET "http://127.0.0.1:3000/admin/users/list/active.json" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: system"
This works for me after adding the user agent option.
curl -A Discourse -X GET "http://discourse.example/admin/users/list/active.json" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: system"
IMHO, examples shouldn’t be published unless they are complete and working…aargh.
The only membership plugin that I know works with both WordPress and Discourse is Memberful. They also have detailed instructions on how to integrate with Discourse here – Integrate Discourse with Memberful | Memberful.com
If you are using any other Membership plugin already, it might be worth reaching out to them and asking them directly. I have used it in my client website portfolio is here.