WP Discourseでのトピック公開エラー

Hi Simon,

I have a site (mycp.org) that has Wordpress as the master SSO. Everything is working well except for publishing to discourse. I had selected autopublish but I saw that this didn’t work with the block editor. I tried checking force publish and then updated the post. No joy. So I installed the classic editor (I’m not enamored with Gutenberg and all of its extra goo.) Tried to publish. No joy. Turned off force and auto and tried to publish an update from the editor (though I didn’t change anything this time). All along I’m getting this error: “There has been an error publishing your post. Please try again.”

Any thoughts on how to correct it or debug it?

Thanks,

paul

Are you getting the error with all posts, or just with a specific post?

If the problem is only happening for a specific post, go to the post’s edit screen and select ‘Custom Fields’ from the Screen Options tab that should be near the upper right of the page:

Once you’ve done that, scroll down to and expand the Custom Fields meta box. If you see any fields that match the ones in this screenshot, you can safely click the ‘Delete’ button for them and try publishing the post to Discourse again. If you see a wpdc_topic_tags field, you can also delete that. It is possible that field is causing the issue (Discourse now returns an error for unallowed tags) - I’m implementing a fix for that right now.

Let me know if this works, or if you’re still getting errors.

Hey Simon,

It has been a while since I have tried with other posts so I can answer that first question. I did follow these instructions. There was one more field not show here, wpdc_publishing_error, which before and after this attempt (it didn’t work) has the value “Forbidden”.

I can try another post and update it if that would help.

Paul

That helps! Can you check the values that you’ve entered on the plugin’s Connection Settings tab? Make sure you are using your Discourse site’s All Users API Key and that the Publishing Username is set to ‘system’. The only case where this shouldn’t be set to ‘system’ is if you have edited the username of the System user on Discourse.

Next, go to your WordPress profile page and check that your Discourse Username exactly matches your username on Discourse. The Discourse Username field is found near the bottom of your WordPress profile page.

My name on Wordpress is Paul_Gross. My Discourse username is Paul_Gross. I don’t see a user named “system” when I go to the Users page on Discourse and search for “system”.

The site user contact name is “system”.

If you go to your Admin / Users / Staff page, you should see a user with the name ‘system’ in the list. If you don’t see that user, it is possible that it was either deleted or renamed.

It’s there. But right now I’m getting a “You are not connected to Discourse” on the WP Discourse Connection page. Not sure why…

Fixed that and still getting Forbidden…

Does the user you are trying to publish the post under have the rights to publish topics in the Discourse category you are publishing the post to? The user who the post is published by is set by the Discourse Username you have set on your profile page.

Could you try publishing a fresh post to your site to see if the issue has something to do with this specific post?

I would think the user, me, Paul_Gross, admin and creator of the post on Wordpress has rights to publish under the category on Discourse that I defined (Research). I am the admin on both sides of this equation. Other reasons for being “forbidden”?

BTW, thanks for your rapid fire dive on this. I have to leave my computer now so I will be able to answer from my phone but real digging requires me to have a big screen and a keyboard (my limitation – not Discourse responsive)!

Paul

「いいね!」 1

It’s no problem. I’m working on a feature right now that will improve the error messages that get returned from Discourse. “Forbidden” on its own isn’t very helpful. When you get a chance, try publishing a fresh topic and let me know how that goes.

「いいね!」 1

Great. W’ill do and will post back…

Hi Simon,

I’m not sure if this counts but I copied the content into a new post and posted it. Still got the Forbidden error code in the custom fields…

Paul

9 posts were split to a new topic: WP Discourse 1.9.5 bug

基本的には、マルチサイト構成で同じ Discourse フォーラムに投稿する 3 つのブログがあります。そのうち 2 つは問題なく動作していますが、1 つが先ほど @pgross 氏が言及した「Forbidden」エラーに似たエラーを返すようになりました。ここでの提案を試してみましたが、効果はありませんでした。すべての投稿は同じユーザーによって行われており、昨日まで数ヶ月間正常に動作していたため、原因がわからずに困っています。

エラーが発生しているサイトと、問題なく動作している他のサイトとの間で、何か違いは見つかりましたか?例えば、エラーが発生しているサイトでは保護されたカテゴリに投稿しようとしていませんか?Discourse に投稿する際にタグを追加していますか?もしそうなら、そのカテゴリでタグの使用が許可されていない可能性があります。

WP Discourse の「Add Featured Links」オプションが有効になっていますか?このオプションは「Publishing settings」タブにあります。

「いいね!」 1

こんにちは、@simon さん。3 つのブログは本質的には同じブログですが、言語が異なります。すべて完全に同じ設定で構成されているため、私の確認では違いは見当たりません。タグの追加は行っておりません。「注目のリンクを追加」オプションは使用しています。

参考になれば幸いです。

編集:念のため追記しますが、新しい投稿でテストを行ったところ問題なく動作しましたが、押し出されなかった特定の投稿は依然として「Forbidden」の状態です。

「いいね!」 1

Query Monitor – WordPress plugin | WordPress.org English (Canada) またはそれに似たプラグインをインストールしてから、再度投稿の公開を試してみてください。Discourse から返されたレスポンスに関する詳細なエラーメッセージが表示されるはずです。

編集:投稿の全文を Discourse に公開していますか、それとも投稿の抜粋のみを公開していますか?

「いいね!」 1