Add link to external SSO profile to profile page

If you use SSO and profile settings are controlled by another site, it’s confusing that you cannot change them on your profile page.

Can someone show me how to add something like a “Edit Profile on SITE” button to the nav menu on the user preferences page?

Or, is there some better idea?

1 Like

Being a parent (authentication site) entails so many responsibilities, Jay!

3 Likes

That’s so true. It would be nice, though, if the child had a way to tell people just where its parent was.

I had a site like that, and the only thing that users had to change on parent was the avatar. I went with a site customization of the preferences template that changed the avatar button (the little pencil) to a link to the outsite avatar service.

https://meta.discourse.org/t/how-to-customize-discourse-templates/34813?u=falco

You need to check for changes on the original template on every update tough.

2 Likes

Perhaps we should have an easier way to make that happen? Some kind of button that says

Hey if you want to change any of this click here on this GIANT BUTTON to go to your profile page on the parent site

2 Likes

At SP we customized a template to tell our users that too when we switched to SSO. I’ll see if I can find it here in a moment.

Here it is
https://github.com/sitepoint/discourse-theme/blob/master/assets/javascripts/discourse/templates/connectors/above-user-preferences/sso_notice.hbs

5 Likes

Yeah. That seems good. So then I’d somehow customize the template like this?

Or submit a PR with something like @cpradio’s changes merged into https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/preferences.hbs?

Yeah, I was about to say that myself. It seems we customized that in our fork. Oops.
I’ll bet a PR to add that will be received well. I’ll see what I can do here in a bit.

1 Like

PR Submitted (ping @nec286)

@pfaffman, you would use this howto to implement it via a site customization (also see example below)

<script type='text/x-handlebars' data-template-name='/connectors/above-user-preferences/sso_notice'>
{{#if siteSettings.enable_sso}}
  modified contents of connectors/above-user-preferences/sso_notice.hbs file goes here
{{/if}}
</script>  
5 Likes

Thanks, @cpradio. That seems like what I want.

Oh, and now I think that I understand that this won’t work until your PR has been accepted?

Otherwise, I thought that if I paste this into /admin/customize/css_html/ in the </head> tag.

<script type='text/x-handlebars' data-template-name='/connectors/above-user-preferences/sso_notice'>
{{#if siteSettings.enable_sso}}
  <div class="alert alert-info">
      <p>MY FANTASTIC TEXT.</p>
    </div> 
{{/if}}
</script> 

But that isn’t showing up on /users/pfaffman/preferences.

And then I tried

<script type='text/x-handlebars' data-template-name='/connectors/above-user-preferences/sso_notice'>
  <div class="alert alert-info">
      <p>MY FANTASTIC TEXT.</p>
  </div> 
</script> 

And still no joy.

Correct. My PR is necessary for it to work. I didn’t realize that outlet was in our fork :frowning:

2 Likes

Aha! I finally (kinda sorta thought that maybe I had) figured that out.

Thanks again.

@pfaffman, this is now merged, so let me know if it still doesn’t work after you update to latest. :slight_smile:

3 Likes

It works! It works! Thanks @cpradio. Discourse 1.8.0.beta7.

2 Likes