pfaffman
(Jay Pfaffman)
13 مارس 2017، 9:33م
1
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)
Being a parent (authentication site) entails so many responsibilities, Jay!
3 إعجابات
pfaffman
(Jay Pfaffman)
13 مارس 2017، 9:43م
3
That’s so true. It would be nice, though, if the child had a way to tell people just where its parent was.
Falco
(Falco)
13 مارس 2017، 9:47م
4
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)
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)
cpradio
(cpradio)
13 مارس 2017، 10:00م
6
5 إعجابات
pfaffman
(Jay Pfaffman)
13 مارس 2017، 10:13م
7
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 ?
cpradio
(cpradio)
13 مارس 2017، 10:23م
8
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)
cpradio
(cpradio)
13 مارس 2017، 10:34م
9
PR Submitted (ping @nec286 )
discourse:master
← cpradio:plugin-outlet-user-preferences
opened 10:34PM - 13 Mar 17 UTC
Relevant Discussion:
https://meta.discourse.org/t/add-link-to-external-sso-prof… ile-to-profile-page/59027/7?u=cpradio
@pfaffman , you would use this howto to implement it via a site customization (also see example below)
Discourse includes hundreds of Plugin Outlets which can be used to inject new content or replace existing contend in the Discourse UI. ‘Outlet arguments’ are made available so that content can be customized based on the context.
Choosing an outlet
To find the name of a plugin outlet, search Discourse core for “<PluginOutlet”, or use the plugin outlet locations theme component. (e.g. topic-above-posts).
Wrapper outlets
Some outlets in core look like <PluginOutlet @name="foo" />. These allow …
<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 إعجابات
pfaffman
(Jay Pfaffman)
13 مارس 2017، 11:47م
10
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.
cpradio
(cpradio)
13 مارس 2017، 11:50م
11
Correct. My PR is necessary for it to work. I didn’t realize that outlet was in our fork
إعجابَين (2)
pfaffman
(Jay Pfaffman)
13 مارس 2017، 11:52م
12
Aha! I finally (kinda sorta thought that maybe I had) figured that out.
Thanks again.
cpradio
(cpradio)
14 مارس 2017، 3:07م
13
@pfaffman , this is now merged, so let me know if it still doesn’t work after you update to latest.
3 إعجابات
pfaffman
(Jay Pfaffman)
14 مارس 2017، 4:45م
14
It works! It works! Thanks @cpradio . Discourse 1.8.0.beta7.
إعجابَين (2)