סנכרן את אווטאר מ-Discourse ל-Wordpress באופן אוטומטי

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.

How is this possible please?

Thanks!

Never mind, I managed to do this myself using Webhooks!

Hey Shaun

could you share your solution? We want to achieve the same thing, and I am curious how you managed it. :slight_smile:
Cheers
Jr

במידה ואתה לא ליד המחשב כרגע, הנה השלבים שפעלתיבתקווה שתוכל לעשות את זה אם תקרא על הדברים השונים שהשתמשת בהם:

  1. צור וובהוק של Discourse שמפרסם לקובץ PHP בתוסף/עיצוב שלך בכל פעם שמישהו מעדכן את הפרופיל שלו
  2. בדף ה-PHP, קבל את המטען שמכיל את מזהה המשתמש. קבל את כתובת ה-Avatar ממנו, ושמור אותה כרצועת מטא מותאמת אישית נגד המשתמש ב-WordPress
  3. עדכן את הקוד ב-WordPress שמחזיר את תמונת הפרופיל של המשתמש עם פונקציה שמחזירה במקום זאת את שדה המטא הזה

זהו זה!

I was rather thinking if you could share the code snippets that you used and we could add them here to WP / SSO documentation or community tutorials? :slight_smile:

Sure, once I have access to my computer :grinning_face:

לייק 1