Hey @orenwolf, I’m sorry to hear you’re still having an issue. Could you confirm that the users you’re expecting to be publishing under their own name have a Discourse Username
in their Wordpress profile?
Generally guys, thanks for your patience on this. On my own testing on various sites (and in the plugin’s own unit tests), the Discourse Username
feature is now functioning as expected on 2.3.9
. If you’re still having an issue please confirm you’re on the latest version of the plugin and that the user you’re expecting to be the author of the post has a Discourse Username
.
You might be wondering why this issue arose at all. I think it’ll be helpful if I give a bit of background (which will also answer your question @itsbhanusharma). Previously, the way this feature worked is that it used different users in the Api-Username
header (see here). The reason this was seen as necessary was because the relevant endpoint in Discourse does not support setting a creator of the post different from the user performing the API request.
The upshot of this was that the only way this feature would work is if you have a “All Users” API key with a “Global” scope. I’ll just note that for some time the standard instructions for creating an API key for the WP Discourse plugin are as follows
If you haven’t yet created an API key, Click ‘New API Key’, set User Level to ‘Single User’, set ‘User’ to an admin account, select ‘Global Key’ and click ‘Save’. Copy and paste the API key here.
Following these instructions would mean that this (undocumented) feature would not work, and it has caused issues for various sites.
Moreover, for various security reasons, I’ve progressively been making changes to the plugin to allow for much more specific API keys to be used. This will require a change to Discourse, and (when it gets merged) will allow plugin admins to issue themselves a new, much more limited, API key. I’ll be making an announcement about that when the time comes.
https://github.com/discourse/discourse/pull/15366
Yes @itsbhanusharma the way the feature now works is by making a second request to change the owner of the post after it is created (if a Discourse Username
is present). That is actually currently the only proper way to arbitrarily set the owner of a post via the Discourse API (without needing to use the Api-Username and an All Users Global Key in the way described above). Considering the type of operation this is, this should not be a performance concern.