I’ve tried searching but find topics about doing this the other way round but not this way…
My WordPress website is a DiscourseConnect Provider to my Discourse forum, so people log into the forum with their WordPress account.
I used to have it so you went to the website to update your avatar, using a plugin, and it uploaded that to Discourse, but I’d like to switch this around because the Discourse avatar stuff is so much nicer. I’d like it so the website grabbed the avatar from the Discourse forum on login, or whenever it changes.
Away from computer at the moment but here’s the steps I took, you should be able to do it if you read about the various things I used:
Create a Discourse webhook that posts to a PHP file in your plugin/theme any time someone updates their profile
On the PHP page, get the payload which includes the User ID. Get the avatar URL from that, and save it as a custom meta field against the user in WordPress
Update the code in WordPress that returns a user avatar with a function that instead returns that meta field