Problem linking Discourse forum to WP Discourse

Hello,

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.

What version of WordPress are you using?

Hello Simon, thanks for the answer.

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.

Hi,

Although I put all the needed info to Connection tab but it still shows

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.

Please help.

Discourse: https://forum.biohack.vn
WP: https://biohack.vn
I use admin as the username since it’s the Discourse admin.

Try using ‘system’ for the username.

Already before I switch to admin.

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?

Let’s not open more than one topic on the same exact thing please.

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.

This topic has instructions for publishing posts to Discourse: WP Discourse now supports the WordPress Block Editor. Is this working for you?

제 사이트에서도 비슷한 문제가 발생합니다. WP Discourse를 설치하고 모든 사용자를 위한 키를 생성했으며, 게시 사용자 이름은 system으로 설정되어 있습니다. 그런데도 여전히 "Discourse에 연결되어 있지 않습니다…"라는 메시지가 표시됩니다. 제 사이트는 Cloudflare 프록시를 사용하고 있지만, 제 판단으로는 정상적으로 작동하고 있습니다. 도움을 주시면 정말 감사하겠습니다. Discourse 버전은 2.6.0.b4입니다.

안녕하세요 @sturdy2, 문제가 발생하는 데에는 몇 가지 이유가 있을 수 있습니다. 다음 설정을 시도해 볼 수 있을까요?

Discourse에서: 관리자 사용자를 위한 전역 API 키 생성

설정은 다음과 같이 보아야 합니다.

WordPress에서: 해당 키를 사용하고 "Publishing username"을 선택한 관리자 사용자로 설정

(“Discourse URL” 필드에는 스크린샷에 보이는 것이 아니라 실제 discourse URL을 입력해야 합니다)

@angus 님, 답변 주셔서 감사합니다. 말씀하신 대로 단일 사용자 키를 생성해 보았지만, 여전히 연결이 안 된다는 메시지가 표시됩니다. 생각할 수 있는 모든 방법을 시도해 보았지만 여전히 해결되지 않네요… 다시 한번 감사합니다.

좋아요, 한번 확인해 보겠습니다.

확인차, “글로벌 키”(모든 작업 허용)를 생성하셨나요?

그렇게 하셨다고 가정하고, 다음 사항을 확인해 주세요:

  1. Discourse가 어디에 호스팅되어 있나요? WordPress는 어디에 호스팅되어 있나요?

  2. 설치된 맞춤형 Discourse 플러그인이 있나요?

  3. WordPress에 이 healthcheck 플러그인을 설치해 주세요:

    • 이 플러그인이 치명적인 문제를 감지하나요?

    • 문제 해결(Troubleshooting) 모드를 활성화하고 wp-discourse 플러그인만 활성화하세요(다른 모든 플러그인은 비활성화됩니다). 그런 다음 다시 연결을 시도해 보세요.

네, Global이며 단일 사용자(저, 관리자)입니다. WP Discourse가 연결되지 않습니다.

  1. Discourse는 DO에 호스팅되어 있습니다.
  2. 커스텀 플러그인 관련해서는 잘 모르겠습니다.
    3a. Health Check & Troubleshooting(또는 Site Check)은 이미 오래전에 설치되어 있습니다. Yoast SEO가 보고한 의심스러운 “중요한 문제” 하나는 "검색 엔진에서 사이트를 찾을 수 없습니다"입니다. 추가 문제 해결 지침에는 "Google이 Mobile-Friendly Test를 실행할 수 있다면, Google은 도메인을 크롤링할 수 있습니다. 그 경우 Ryte 경고는 잘못된 것입니다"라고 되어 있습니다. 도메인과 서브도메인 모두 테스트를 통과합니다.
    3b. 이전에 시도했고, 다시 시도했습니다. WP Discourse를 제외한 모든 플러그인을 비활성화했습니다. WP Discourse가 연결되지 않습니다.

업데이트: 며칠 동안 이것을 만져보고 있는데, 이해하지 못하는 것들이 몇 가지 있습니다. 아마도 이 모든 것이 저에게 완전히 새로운 것이라서 그런 것 같습니다.

  1. discourse 서브도메인의 DNS “A” 레코드는 DO가 할당한 IP(SSH에 사용하는 것과 동일한 IP)를 가리키지만, dig discourse.example.com은 Cloudflare가 할당한 것으로 보이는 세 개의 서로 다른 IP를 가리키고, dig https://discourse.example.com은 GB에 있는 whois BAREFRUIT-ERRORHANDLING의 다른 IP를 가리킵니다. 뭔가 이상합니다!

  2. WP Discourse가 Discourse와 연결하기 위해 cURL을 사용한다고 가정하고, cURL과 Discourse API를 실험해 왔습니다. API 키가 세 개 있습니다(위에서 확인된 키 포함). 어제까지 세 키 모두 '사용 안 함(Never Used)'으로 표시되었습니다. 어제, 지난 8월에 생성된 원래 키가 하루 전에 사용된 것으로 표시되는 것을 확인했습니다. 나머지 두 개는 여전히 '사용 안 함’으로 표시되고 있습니다. 이는 아마도 제 cURL 실험 중 하나 이상이 실제로 연결되었음을 의미한다고 추정합니다. 불행히도 실제로 작동한 것이 무엇인지 모릅니다. 또한 http 200을 생성하는 cURL 명령은 API Last Used 정보를 변경하지 않는다는 점도 주목했습니다(여전히 '사용 안 함’으로 유지됨).

위 #1과 #2 모두 저에게는 중요해 보이지만, 아직 문제를 파악할 수 없습니다.

지연에 대해 사과드립니다. 가끔은 생활이 개입하기도 합니다. 다시 한번, @angus, 도움을 주셔서 감사합니다.

네, 설정에서 Cloudflare를 제거해 볼 수 있을까요? 오류의 잠재적 원인을 좁혀야 합니다.

안녕하세요 @angus,

추가 업데이트입니다: Query Monitor 플러그인(WP용)을 설치했습니다(아래 출력 참조).

로컬 컴퓨터에서 cURL을 사용해도 403 오류가 발생하여, 제 사이트와 WP Discourse 사이의 상류(upstream) 문제인 것 같습니다. 아마도 Cloudflare 때문일 수 있지만, 아직 Cloudflare를 제거하고 싶지는 않습니다. 아래 내용을 확인해 주세요.

느리게 진행해서 죄송합니다. 호스팅 서비스에서 제 사이트가 다른 서버로 마이그레이션 중이며, IP 변경을 포함한 몇 가지 변경 사항이 있을 것이라는 통보를 받았습니다. 따라서 이 문제에 대한 추가 작업을 잠시 미뤄야 합니다. 상황이 정리되면 다시 도움을 요청해도 될까요?

수정: 해결! /admin/site_settings/category/security → 허용된 크롤러 사용자 에이전트 설정에 버그가 있었던 것 같습니다.
허용 UA 텍스트에 항목이 입력되면, 로컬 컴퓨터에서 실행한 curl 명령조차도 모두 차단되는 것으로 보입니다. 텍스트를 비워 두면 즉시 WP Discourse에서 " Discourse에 연결되었습니다!" 메시지가 표시됩니다.

찾으셨다니 다행입니다! :tada:

네, 해당 설정은 상당히 제한적으로 의도된 것 같습니다 (설명문에 대문자 경고가 있는 이유이기도 하죠).

allowed crawler user agents를 사용하면서 워드프레스 인스턴스를 허용하려면 다음과 같이 추가할 수 있습니다:

Wordpress/<wordpress_version>

테스트용 워드프레스 / 디스코스에 Wordpress/5.5.3을 allowed crawler user agents에 추가하여 테스트해 보았고, 정상적으로 작동했습니다 :+1:

워드프레스를 업그레이드할 때마다 해당 설정을 계속 업데이트하고 싶지 않다면, 워드프레스에서 이러한 유형의 요청에 대한 사용자 지정 user agent를 설정하는 간단한 플러그인을 사용할 수 있습니다. 예를 들어:

설명해 주셔서 감사합니다. 이제 조금씩 이해가 가기 시작합니다. 처음에는 "허용된 크롤러 사용자 에이전트"가 허용된 검색 엔진 크롤러를 식별하기 위한 것이라고 생각했습니다. WP Discourse가 Wordpress 사용자 에이전트를 사용한다는 점을 이해하지 못한 채 처음에 "Googlebot"을 입력했는데, 그 결과 차단되었습니다. 또 하나의 초보자 실수네요. 이것은 흔한 오해라고 생각하지만, 제한된 문서와 더 제한적인 예제 속에서 관련 내용을 찾지 못했습니다.

"허용된 크롤러 사용자 에이전트"에는 현재 Wordpress(버전 불필요), Googlebot, 그리고 Discourse(아래의 cURL 사용 시를 위해 추가)를 입력하고 있습니다. 여기에 문제가 있을까요? 아니면 다른 것을 추가해야 할까요?

Discourse API를 사용하는 cURL도 비슷한 것 같습니다. 이전에 사용자 에이전트를 아래처럼 추가하기 전까지는 403 오류가 발생했습니다.

Discourse API 문서에 게시된 첫 번째 예제(제 환경에서는 작동하지 않음):
curl -X GET "http://127.0.0.1:3000/admin/users/list/active.json" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: system"
사용자 에이전트 옵션을 추가한 후 제 환경에서는 이렇게 작동합니다.
curl -A Discourse -X GET "http://discourse.example/admin/users/list/active.json" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: system"

개인적 의견으로는, 예제는 완전하고 작동하는 상태가 아니라면 게시해서는 안 된다고 생각합니다… 아아.

@angus, 도움과 지원을 주셔서 정말 감사합니다.

안녕하세요,

WordPress와 Discourse 모두와 함께 작동하는 멤버십 플러그인으로 제가 아는 것은 Memberful뿐입니다. Discourse와 통합하는 방법에 대한 자세한 안내도 제공하며, 관련 내용은 여기서 확인할 수 있습니다 – Integrate Discourse with Memberful - Memberful

이미 다른 멤버십 플러그인을 사용 중이라면, 해당 업체에 직접 문의해 보는 것이 도움이 될 수 있습니다. 저는 이 플러그인을 제 클라이언트 웹사이트 포트폴리오에서도 사용해 왔습니다.