I run a multi-author wordpress blog. How can I get the posting to work without having to have all my authors create an account on discourse? Should I be using SSO with wordpress and discourse to solve this issue?
If you want authors to be able to publish posts under their own name on Discourse, they will need to create Discourse accounts. SSO is a good approach for this, but when SSO is enabled user will only be able to login to your forum through the WordPress site. This may not be what you want.
Another option would be to publish all posts from WordPress to Discourse under a single Discourse Username. If users leave their Discourse Username setting blank, posts will be published to Discourse by the Publishing Username you have set in the plugin’s Connection settings tab.
Interesting… As far as I can tell none of my authors have that set. When I look at the user profiles, I do not see the option for a discourse username setting. Where would I find that?
Additionally, I just noticed that I’m using the following setting in the discourse wp plugin:
Removes the Discourse Name field from the WordPress user profile page.
Do Not Display Discourse Name Field - Unless SSO is enabled, this setting will cause all posts published to Discourse to be published by the 'Publishing Username.
It’s my understanding that the above setting will force all posts to be posted to the user that has been defined as the posting user in the “Publishing Username” setting.
What am I missing?
Thanks. I just realized that I had the Do Not Display Discourse Name Field set. Which should have forced all posts to the Posting Username.
Yeah, turn that off if you want them posted by the author’s own Discourse username, which you will hopefully be able to set no problem. (Some themes, such as Extra, prevent the username from being edited by hiding it on the profile page.)
Edited to add: Now I see the title of this topic is an error number. I’m not sure anything I’ve said will solve that.
Yes, this is how it is supposed to work. Are you able to publish posts with your account from WordPress to Discourse?
The most common cause of the
403 error when posts are published to Discourse is that the Discourse Username is set incorrectly. It might be worth disabling the ‘Do Not Display Discourse Name Field’ setting and having a look at the profile pages of some of your authors. Make sure that the Discourse Username field for the authors is empty. It is found in the Contact Info section of the user’s profile page.
We are going to be moving the Discourse Username out of the Contact Info section very soon, and also giving site admins the option to set the Discourse Username for their authors manually while hiding the setting from the authors. This is for security reasons - to ensure that people are using the correct Discourse Username on multi-author sites.
Okay. that’s what I was expecting.
I was thinking that the issue was related to the usernames not matching, but thought when I enabled the “Do not display Discourse Name Field” it would override everything.
I think the change you mentioned would be a really helpful.
I just tried posting with the option turned off, but got the same error.
After turning off the option, can you take a look at your profile page to make sure that the Discourse Username field is empty?
The discourse usernames are blank for all users.
When you go to the WP Discourse connection options tab, are you seeing a messge saying that ‘You are connected to Discourse’?
For the API Key and Publishing Username settings on the Connection options tab, are you using your Discourse forum’s All Users API Key? Is the Publishing Username set to the name of your site’s system user? The default username for the system user is ‘system’.
Yes. In the connection options tab I’m seeing the message “You are connected to Discourse.”
The API key is the all users and the publishing name is the admin of the discourse forum. The username is not the system user “system”.
Could you try changing the username to ‘system’ (without the quotes) to see if that makes a difference?
I changed the username to system, but get the same error message.
“There has been an error publishing this post to Discourse.”
Here’s the details that show in the error email:
Reason for failure:
A 403 response code was returned from Discourse.
- the author has correctly set their Discourse username
Does anyone have any other ideas on how to resolve this?
Only thing I can think of to try is to create a new api key and re enter everything.
okay… it’s very strange… I’m using nodechef to host discourse… I wonder if it’s an issue with their build or server configuration. Thoughts?
I tried changing key’s and still have the same issue.
Thanks for the details about your hosting. I should have asked about that. It is possible the issue is related to their hosting. It is not a problem I have come across with our hosting, or with sites hosted on https://www.discoursehosting.com/, or self-hosted sites.
If you have WP-CLI available on your WordPress site, the easiest way to debug this would be to try and create a Discourse topic from the wp console, using the same credentials as you are using in your WP Discourse configuration. The response to that request would give some details about the issue.
Okay. I’ll give that a try.
I was thinking about setting up a self hosted config on my aws account. I’ll give that a try and see if It has the same issues. Thank you for your help