WP Discourse "Update Discourse topic" error


#1

Hi,

I am create blog post and linked existing topic. Discourse topic not updated, blog post url not seems on the topic.

Also, i tried “Update Discourse topic” on Wordpress panel. It gives me error:

There has been an error publishing this post to Discourse.

Reason for failure:
A 422 response code was returned from Discourse.
Unprocessable Entity

Any ideas?


(Simon Cossar) #2

When you link a post to a Discourse topic, it does not update the topic until you select the ‘Update Discourse topic’ checkbox. Linked posts do not add the blog URL to the Discourse topic.

Can you try this with another post and see if you get the same error?


#3

I selected ‘Update Discourse topic’ checkbox. When i tried another post, it works.


(Simon Cossar) #4

Thanks for trying that! Can you give any details about the post that is returning the 422 error? Does the topic that it is linked to exist on your forum?


(Quim Gil) #5

We are finding this problem right now, and I think I can contribute to this discussion. What happened in our case is:

  1. An article is published in WordPress and a related topic is automatically created in Discourse.
  2. However, for whatever reason (user post limit?), the new topic goes automatically to moderation.
  3. The moderated topic is not public, The WP-Discourse plugin cannot “see it” and throws a first error message: Reason for failure: A bad response was returned from Discourse. Check that: - your Discourse forum is online.

If the moderator approves the post because everything is correct there, then…

When updating the article in WordPress in order to have a Discourse topic linked, the WP-Discourse plugin finds an article with an identical title / content, and this is what cause a second error message:

Reason for failure:
A 422 response code was returned from Discourse.
Unprocessable Entity

The solution is to delete the first Discourse topic and update the page again.


(Simon Cossar) #6

Thanks for mentioning this. If a post that is published to Discourse gets added to the Needs Approval queue, the WordPress plugin should give some feedback about how to deal with it.

After the post has been approved you can also select the ‘Link to Existing Topic’ option from the post’s Discourse metabox. In the Topic URL field, enter the URL of the approved Discourse topic.


(Quim Gil) #8

Yeah, I wonder why occasionally a post of these goes to moderation. It is sent by a trusted user. Maybe there is some kind of throttle? Several posts might be queued in WordPress, and then an administrator reviews them and might approve several of them pretty quickly.

Not in our case because we have the “Force publish” option enabled. Therefore the metabox only says.

The force-publish option has been enabled. All WordPress posts will be published to Discourse in the Kaosenlared category.

Once you know what is going on, it is not a big deal.


(Simon Cossar) #9

When posts that are published from WordPress to Discourse get added to the Discourse approval queue, the user publishing the post should now see this message:

01%20PM

When the topic is approved on Discourse and the Topic URL is updated on WordPress, they will see this:

23%20PM

Let me know if you are finding any posts that are added to the approval queue on Discourse but are not displaying this message on WordPress.