مشكلة في ربط منتدى Discourse بـ 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?

3 إعجابات

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.

3 إعجابات

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.

إعجاب واحد (1)

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.

إعجابَين (2)

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?

إعجاب واحد (1)

موقعي يواجه مشكلة مشابهة. قمت بتثبيت WP Discourse، وأنشأت مفتاحًا لجميع المستخدمين، واسم المستخدم الناشر هو system. ومع ذلك، لا يزال يظهر لي رسالة “أنت غير متصل بـ Discourse…” موقعي محمي بواسطة Cloudflare، ولكن يبدو أن ذلك يعمل بشكل صحيح حسب ما أستطيع تحديده. أي مساعدة مبدية جدًا. الإصدار الحالي من Discourse هو 2.6.0.b4.

مرحبًا بك يا @sturdy2، هناك عدة أسباب قد تؤدي إلى هذه المشكلة. هل يمكنك تجربة هذا الإعداد من أجلي؟

في Discourse: إنشاء مفتاح API عام لمستخدم مدير

يجب أن يبدو الإعداد كما يلي

في WordPress: استخدم هذا المفتاح وحدد “اسم المستخدم للنشر” كمستخدم المدير الذي اخترته

(يجب أن يحتوي حقل “عنوان URL الخاص بـ Discourse” على عنوان URL الخاص بـ Discourse، وليس ما يظهر في لقطة الشاشة)

إعجاب واحد (1)

مرحبًا @angus، شكرًا لك على الرد. للأسف، بعد إنشاء مفتاح المستخدم الفردي كما أشرت، ما زلت أواجه رسالة «لا توجد اتصال». لقد جربت كل ما يمكنني التفكير فيه دون جدوى… شكرًا مرة أخرى.

حسناً، دعنا نرى ما إذا كان بإمكاننا حل المشكلة.

فقط للتأكيد، هل أنشأت “مفتاحًا عالميًا” (يسمح بجميع الإجراءات)؟

بافتراض أنك فعلت ذلك، دعنا نتحقق من النقاط التالية:

  1. أين يستضاف نظام Discourse الخاص بك؟ وأين يستضاف نظام Wordpress الخاص بك؟

  2. هل لديك أي إضافات مخصصة لـ Discourse مثبتة؟

  3. يرجى تثبيت إضافة فحص الصحة هذه على Wordpress:

    • هل تكشف هذه الإضافة عن أي مشاكل حرجة؟

    • فعّل وضع استكشاف الأخطاء وإصلاحها، وقم بتفعيل إضافة wp-discourse فقط (سيتم تعطيل جميع الإضافات الأخرى). ثم حاول الاتصال مرة أخرى.

إعجاب واحد (1)

نعم، مفتاح عام، مستخدم واحد (أنا، المسؤول). لا يتصل WP Discourse.

  1. استضافت Discourse بواسطة DO
  2. غير متأكد بشأن الإضافات المخصصة.
    3أ. تم تثبيت فحص الصحة واستكشاف الأخطاء وإصلاحها (المعروف أيضًا باسم فحص الموقع) منذ فترة. تشير إحدى “المشاكل الحرجة” المشكوك فيها التي أبلغ عنها Yoast SEO إلى “لا يمكن لمحركات البحث العثور على موقعك.” وتوضح تعليمات استكشاف الأخطاء الإضافية أنه “إذا كان بإمكان Google تشغيل اختبار توافق الجوال، فإن Google يمكنها أيضًا الزحف إلى النطاق. في هذه الحالة، فإن تحذير Ryte غير صحيح.” كلا النطاق والنطاق الفرعي يجتازان الاختبار.
    3ب. جربت هذا سابقًا ومرة أخرى. تم تعطيل جميع الإضافات باستثناء WP Discourse. لا يتصل WP Discourse.

تحديث: لقد كنت أعمل على هذا لعدة أيام وهناك عدة أشياء لا أفهمها، ربما لأن كل هذا جديد تمامًا بالنسبة لي.

  1. سجل DNS “A” للنطاق الفرعي discourse يشير إلى عنوان IP المخصص من قبل DO (نفس عنوان IP الذي أستخدمه لـ SSH) ولكن dig discourse.example.com يشير إلى ثلاثة عناوين IP مختلفة يبدو أنها مخصصة بواسطة Cloudflare، و dig https://discourse.example.com يشير إلى عنوان IP آخر whois BAREFRUIT-ERRORHANDLING في بريطانيا العظمى. هناك شيء غير صحيح هنا!

  2. أفترض أن WP Discourse يستخدم cURL للاتصال بـ Discourse، لذا كنت أجرب cURL وواجهة برمجة تطبيقات Discourse. لدي ثلاثة مفاتيح API (بما في ذلك المفتاح المؤكد أعلاه). حتى الأمس، أشارت جميع المفاتيح الثلاثة إلى “لم تُستخدم أبدًا”. أمس، لاحظت أن المفتاح الأصلي الذي تم إنشاؤه في أغسطس الماضي يشير الآن إلى أنه تم استخدامه قبل يوم واحد! بينما ما زالت المفاتيح الأخرى تشير إلى “لم تُستخدم أبدًا”. أفترض أن هذا يعني على الأرجح أن أحد تجارب cURL أو أكثر نجح في الاتصال؛ للأسف، لا أعرف أي منها نجح فعليًا. كما لاحظت أن أوامر cURL التي تنتج استجابة HTTP 200 لا تغير معلومات آخر استخدام لـ API (تظل “لم تُستخدم أبدًا”).

يبدوان #1 و#2 أعلاه مهمين بالنسبة لي، لكنني لا أستطيع بعد تحديد المشكلات.

أعتذر عن التأخير؛ أحيانًا تتدخل الحياة. مرة أخرى، @angus، شكرًا لك على مساعدتك.

حسناً، هل يمكنك تجربة إزالة Cloudflare من إعداداتك؟ نحتاج إلى تضييق نطاق مصادر الأخطاء المحتملة.

إعجاب واحد (1)

مرحبًا @angus،
تحديث آخر: قمت بتثبيت إضافة Query Monitor (في ووردبريس) (انظر المخرجات أدناه).

عند استخدام cURL من جهاز الكمبيوتر المحلي، أحصل أيضًا على خطأ 403، لذا يبدو لي أن هذه مشكلة في المصدر تتعلق بموقعي وإضافة WP Discourse. ربما تكون المشكلة من Cloudflare، لكنني لا أريد إزالة Cloudflare بعد. انظر أدناه.

اعتذار آخر عن تأخري. لقد تلقيت إشعارًا من خدمة الاستضافة الخاصة بي بأن موقعي سيتم نقله إلى خادم آخر، وستحدث بعض التغييرات، بما في ذلك تغيير عنوان IP. لذا، أحتاج إلى تأجيل العمل الإضافي على هذه المشكلة. هل يمكنني الرجوع إليك مرة أخرى بعد استقرار الأمور؟

تعديل: تم الحل! ربما كان هناك خلل في /admin/site_settings/category/security → السماح لوكلاء المستخدم (user agents) للزواحف.
يبدو أن أي إدخال في نص السماح بـ UA يتسبب في حظر الجميع، حتى أمر curl من سطر الأوامر على جهاز الكمبيوتر المحلي. إعادة تعيين النص إلى فارغ يؤدي فورًا إلى ظهور رسالة WP Discourse " أنت متصل بـ Discourse!".

3 إعجابات

يسعدنا أنك تمكنت من حل المشكلة! :tada:

نعم، أعتقد أن هذا الإعداد مصمم ليكون مقيدًا للغاية (ومن هنا جاءت تحذيرات الأحرف الكبيرة في التعليمات).

للسماح لموقع ووردبريس الخاص بك بالمرور أثناء استخدام allowed crawler user agents، يمكنك إضافته على النحو التالي:

Wordpress/<wordpress_version>

لقد اختبرت ذلك للتو على موقعي التجريبي من ووردبريس/ديسكورت بإضافة Wordpress/5.5.3 إلى allowed crawler user agents وقد نجح الأمر :+1:

إذا لم ترغب في تحديث ذلك كل مرة ترقية فيها ووردبريس، يمكنك استخدام إضافة بسيطة لتعيين معرف المستخدم الخاص بك لهذه النوع من الطلبات في ووردبريس، مثل:

إعجابَين (2)

شكرًا على التوضيح. بدأ الأمر يكتسب معنىً أوضح بالنسبة لي. في البداية، اعتقدت أن عبارة “وكلاء مستخدمين للزحف المسموح بهم” تهدف إلى تحديد محركات البحث المسموح بها. وقد قمت بإدخال “Googlebot” في البداية دون إدراك أن WP Discourse يستخدم وكيل مستخدم خاص بـ WordPress، مما أدى إلى حظره. إنها مجرد خطأ آخر من مبتدئ. أظن أن هذا سوء فهم شائع، لكنني لم أجد أي شيء في التوثيق المحدود أو الأمثلة الأكثر محدودية.

أما بخصوص “وكلاء مستخدمين للزحف المسموح بهم”، فأنا أستخدم الآن: WordPress (لا حاجة للإصدار)، Googlebot، وDiscourse (تمت إضافتها للاستخدام مع cURL كما هو موضح أدناه). هل ترى أي مشكلة؟ أم أنني بحاجة لإضافة آخرين؟

يبدو الأمر مشابهًا عند استخدام cURL مع واجهة برمجة تطبيقات Discourse. لقد كنت أستقبل سابقًا رمز خطأ 403 حتى أضفت وكيل المستخدم كما هو موضح أدناه.

مثال أول نُشر في وثائق واجهة برمجة تطبيقات Discourse (لا يعمل معي):
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، شكرًا جزيلاً على مساعدتك وتعاونك.

إعجاب واحد (1)

مرحبًا،

أعلم فقط أن إضافة العضوية (Memberful) تعمل مع كل من WordPress و Discourse. كما يقدمون تعليمات مفصلة حول كيفية التكامل مع Discourse هنا – Integrate Discourse with Memberful - Memberful

إذا كنت تستخدم إضافة عضوية أخرى بالفعل، فقد يكون من الجيد التواصل معهم مباشرة والاستفسار. لقد استخدمتها في معرض مواقع العملاء الخاص بي.

إعجابَين (2)