Embedding Discourse Profile via Javascript


(Sergei Petrunin) #1

Hello,

Me and my team now integrating Discourse into our website. We are using Profile-like system on it, where users can setup our site’s specific settings (e.g. their favorite football teams, preferred timezone and etc).

Discourse itself got pretty strong Profile system with messages, like counters and etc, but unfortunately it’s bound to Discourse sub-domain, so users ended-up with two different profiles in different places (not to mention two ‘log out’ buttons).

The idea of this feature is pretty simple, like in the case with embedding comments in Embedding Discourse Comments via Javascript, we embed part of user’s profile page in some logical place on our website.

The result of this would be a website, with all user specific data on one page called “Profile”, say with two sections: ‘Site specific’ and ‘Discussions specific’, single Log-out link and not-confused users! On Discourse side, click on user avatar will send user to exact same ‘Profile’ page.

I hope that this feature can help to any website with it’s own user’s/profile’s system seamlessly integrate Discourse with SSO.

We are not a Ruby programmers, but we know Javascript and can participate in this feature realization.
Your thoughts?
Thanks for attention!


(Logan Mathews) #2

This is definitely something that I and others would likely be interested in. Yes, it should definitely be possible as the endpoint already exists (at least if I recall correctly).


(Erlend Sogge Heggen) #3

What you’re talking about is a super tight SSO integration. I don’t know if we have any examples of anyone going to quite this length, but it should be doable just using the Discourse API. You most likely don’t wanna be embedding user preferences in other pages.

I think the idea of a 100% centralised profile is a pipe dream though. Literally no one does this, because centralisation eventually needs to make way for context. There’s some overlap between your Google Plus profile and your YouTube account for instance, but managing your YouTube notification preferences, followed channels etc. makes a whole lot more sense in the context of YouTube as opposed to inside Google Plus.

I wouldn’t want things like my Discourse e-mail notifications or “Consider new when” preferences in a non-Discourse page. That easily gets super confusing.

I can get behind a hybrid system though, which some Discourse sites are already doing to varying degrees. Like:

Lock up the following options in preferences:

  • Username
  • Name
  • Email
  • Password
  • Profile picture
  • Profile background
  • User card background
  • Interface language
  • About me
  • Location
  • Website

And only make them editable through a parent profile which is set up as the SSO provider.


(Sergei Petrunin) #4

Thanks for quick reply’s

Yes, I think my initial intention was embed ‘Preferences’ section (or part of it) of Discourse Profile and not the whole Profile page with messages and etc.

Do it with Discourse API seems like a pretty good solution, I’ll give it a try!

Your example of comparing YouTube and Google Plus is not exactly fit, because they are distinct brands (owned by Google obviously, but still distinct). But when someone will make a site and a forum section, they likely wanted both to be under the same brand and have one profile page when user can set their email or language. Or may be one Profile page and one Settings page that looks alike.

I found a better example, consider Google Plus’s Profile page and Settings page. They are different, but still share the same header and looks alike.

So my proposal here is to invent possibility to move User’s Preferences a bit away, or may be, set for them a different header.

Or may be the possibility to embed just Username and Avatar, so it will always be visible, not only in Discourse.

I’ll think about it a little more and may be come up with good example.


#5

Hi @Strikki_Strik

Did you make any progress with the above? We have very similar requirements to you integrating to an existing site with existing profiles and are wondering if you had any success?

Pete


(Sergei Petrunin) #6

Unfortunately, I give it up.
The solution I come up with is the following:
We use 2 separate profiles - 1st is main site profile, containing settings such as language, timezone and other site specific things as well as link to Discourse Profile and - 2nd - Discourse profile itself without any changes.

I still hope to see described solution, but understand that it’s pretty hard to develop correctly, so two profiles seems ok for us.

If you want to investigate this, I can try to help (I’m not a Ruby pro, but can help with JS maybe:) Let me know.


#7

Thanks for the quick response.

Did you spend much time trying to get this to work, as you say it seems like it will be pretty hard to get working properly.

I’ll let you know how we go, we’d really like to avoid having separate profile pages.

Pete


(Sergei Petrunin) #8

To be honest, no, I spent about 2 hours wandering plus I discuss this idea with couple of my friends and co-workers and we agreed on having two profiles.

But as I say, I will try to participate if some one will start developing this feature:)
In case if I learn Ruby later, I try to do it myself, but it’s takes way more time:)