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.
Anche il mio sito presenta un problema simile. Ho installato WP Discourse, creato una chiave per tutti gli utenti e il nome utente di pubblicazione è “system”. Eppure continuo a vedere il messaggio “Non sei connesso a Discourse…”. Il mio sito è gestito tramite proxy da Cloudflare, ma per quanto ne so funziona correttamente. Qualsiasi aiuto sarebbe molto apprezzato. La versione di Discourse è 2.6.0.b4.
Ciao @angus, grazie per la risposta. Purtroppo, dopo aver creato la chiave per un singolo utente come hai indicato, ricevo ancora il messaggio di ‘nessuna connessione’. Ho provato tutto quello che mi è venuto in mente, ma senza successo… grazie ancora.
Abilita la modalità di risoluzione dei problemi e attiva solo il plugin wp-discourse (tutti gli altri plugin verranno disabilitati). Quindi prova a connetterti di nuovo.
3a. Health Check & Troubleshooting (aka Site Check) è installato da qualche tempo. Un “problema critico” discutibile segnalato da Yoast SEO è: “Il tuo sito non può essere trovato dai motori di ricerca”. Le istruzioni per l’ulteriore risoluzione dei problemi affermano che “se Google può eseguire il test Mobile-Friendly, può anche eseguire la scansione del dominio. In tal caso, l’avviso di Ryte è errato.” Sia il dominio che il sottodominio superano il test.
3b. Ho provato questo in precedenza e di nuovo. Tutti i plugin tranne WP Discourse disabilitati. WP Discourse non si connette.
AGGIORNAMENTO: Sto lavorando su questo da diversi giorni e ci sono diverse cose che non capisco, probabilmente perché quasi tutto è completamente nuovo per me.
Il record DNS “A” per il sottodominio discourse punta all’IP assegnato da DO (lo stesso IP che uso per SSH), ma dig discourse.example.com punta a tre IP diversi apparentemente assegnati da Cloudflare e dig https://discourse.example.com punta a un altro IP whois BAREFRUIT-ERRORHANDLING nel Regno Unito. C’è qualcosa che non va!
Presumo che WP Discourse utilizzi cURL per connettersi a Discourse, quindi ho sperimentato con cURL e l’API di Discourse. Ho tre chiavi API (inclusa la chiave confermata sopra). Fino a ieri tutte e tre indicavano “Mai usata”. Ieri ho notato che la chiave originale creata ad agosto ora indica che è stata usata un giorno fa! Le altre due indicano ancora “Mai usata”. Presumo che questo significhi probabilmente che uno o più dei miei esperimenti con cURL si sono effettivamente connessi; purtroppo, non so quale abbia funzionato. Ho anche notato che i comandi cURL che restituiscono http 200 non modificano le informazioni “Ultimo utilizzo API” (rimane “Mai usata”).
Sia il punto #1 che il punto #2 sopra sembrano importanti per me, ma non riesco ancora a determinare i problemi.
Mi scuso per il ritardo; a volte la vita interferisce. Ancora una volta, @angus, grazie per il tuo aiuto.
Utilizzando cURL dal mio computer locale, ottengo anch’io un errore 403, quindi sembra che si tratti di un problema a monte tra il mio sito e WP Discourse. Probabilmente è Cloudflare, ma non voglio rimuoverlo per ora. Vedi sotto.
Mi scuso ancora per il mio ritardo. Ho ricevuto una notifica dal mio servizio di hosting che il mio sito verrà migrato su un altro server e ci saranno alcune modifiche, incluso un cambio di indirizzo IP. Quindi devo rimandare ulteriori lavori su questo problema. Posso rivolgermi a te di nuovo quando le cose si saranno stabilizzate?
EDIT: Risolto! Forse un bug in /admin/site_settings/category/security → user agent dei crawler consentiti.
Sembra che qualsiasi voce nel campo di testo per gli UA consentiti causi il blocco di tutti, persino un comando curl dalla riga di comando dal mio computer locale. Impostando il testo su vuoto, si ottiene immediatamente da WP Discourse il messaggio " Sei connesso a Discourse!"
Sì, credo che quell’impostazione sia intesa per essere piuttosto restrittiva (da qui l’avviso in MAIUSCOLO nelle istruzioni).
Per consentire il passaggio alla tua istanza di WordPress mentre utilizzi allowed crawler user agents, puoi aggiungerla così:
Wordpress/<versione_wordpress>
Ho appena testato questa soluzione sul mio ambiente di test WordPress / Discourse aggiungendo Wordpress/5.5.3 a allowed crawler user agents e ha funzionato
Se non desideri aggiornare quella lista ogni volta che aggiorni WordPress, puoi utilizzare un semplice plugin per impostare il tuo user agent per questo tipo di richieste in WordPress, ad esempio:
Grazie per la spiegazione. Sto iniziando a capire meglio. Inizialmente pensavo che “allowed crawler user agents” servisse a identificare i crawler dei motori di ricerca consentiti. Ho inserito “Googlebot” senza sapere che WP Discourse utilizza un User Agent di WordPress, finendo così per essere bloccato. Solo un altro errore da principiante. Penso sia un malinteso comune, ma non ho trovato nulla nella documentazione limitata e negli esempi ancora più scarsi.
Come “allowed crawler user agents” sto ora usando: Wordpress (la versione non è necessaria), Googlebot e Discourse (aggiunto per l’uso con cURL come mostrato sotto. Vedi qualche problema? O devo aggiungerne altri?
Sembra simile con cURL che utilizza l’API di Discourse. In precedenza ricevevo un errore 403 finché non ho aggiunto l’user agent come sotto.
Primo esempio pubblicato nella documentazione dell'API di Discourse (non funziona per me):
curl -X GET "http://127.0.0.1:3000/admin/users/list/active.json" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: system"
Questo funziona per me dopo aver aggiunto l'opzione user agent.
curl -A Discourse -X GET "http://discourse.example/admin/users/list/active.json" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: system"
A mio avviso, gli esempi non dovrebbero essere pubblicati se non sono completi e funzionanti… aargh.
@angus, molte grazie per il tuo aiuto e il tuo supporto.
L’unico plugin per membership che conosco e che funziona sia con WordPress che con Discourse è Memberful. Offrono anche istruzioni dettagliate su come integrarlo con Discourse qui – Integrate Discourse with Memberful - Memberful
Se stai già utilizzando un altro plugin per membership, potrebbe valere la pena contattarli direttamente. L’ho utilizzato nel mio portfolio di siti web per clienti.