# Using Primetime SSO & wp-discourse plugin

**URL:** https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447
**Category:** WordPress
**Tags:** sso, wordpress, discourseconnect
**Created:** [April 11, 2015, 10:45am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447 "2015-04-11T10:45:24Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![franwess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franwess/32/115950_2.png) [@franwess](https://meta.discourse.org/u/franwess)
#### Post date: [April 11, 2015, 10:45am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/1 "2015-04-11T10:45:24Z")

</div>

Hi there, just checking if someone is using Primetime Single Sign-on ([PrimeTime WordPress + Discourse SSO – WordPress plugin | WordPress.org](https://wordpress.org/plugins/pt-wp-discourse-sso/)) with the wp-discourse plugin? Can these two co-exist happily with one another?  
Thanks

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [April 11, 2015, 2:33pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/2 "2015-04-11T14:33:24Z")

</div>

What does the primetime sso plugin do that the wp-discourse plugin does  
not?

---

<div class="post-metadata">

### Author: ![purldator](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@purldator](https://meta.discourse.org/u/purldator)
#### Post date: [April 11, 2015, 2:40pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/3 "2015-04-11T14:40:09Z")

</div>

I see the concern but I feel they won’t conflict with each other. They are doing two very separate things.

wp-discourse allows WordPress to have comments backed by Discourse (ala Disqus). The SSO plugin is only concerned with the function of logging into Discourse from a WordPress user database. I’d be surprised if they conflicted.

Feel free to use it @franwess and tell us your experience. :smiley:

EDIT: However, @tobiaseigen’s clarification below my post here raises a question that is important because wp-discourse already offers SSO. What _does_ this PrimeTime plugin do extra that wp-discourse does not in terms of SSO?

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [April 11, 2015, 2:42pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/4 "2015-04-11T14:42:46Z")

</div>

But wp-discourse also provides sso so why install another plugin? Does primetime somehow do it better?

---

<div class="post-metadata">

### Author: ![purldator](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@purldator](https://meta.discourse.org/u/purldator)
#### Post date: [April 11, 2015, 2:43pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/5 "2015-04-11T14:43:46Z")

</div>

Ahh, I didn’t know that. Thank you for saying something.

In that case your question is very important, especially if the wp-discourse plugin can learn a thing or two from this PrimeTime plugin.

---

<div class="post-metadata">

### Author: ![franwess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franwess/32/115950_2.png) [@franwess](https://meta.discourse.org/u/franwess)
#### Post date: [April 12, 2015, 6:54am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/6 "2015-04-12T06:54:06Z")

</div>

thanks for the reply, I only saw now on the Github page that wp-discourse also does SSO :slight_smile: I think the Primetime plugin does SSO in cases where yo do not necessarily want to sync over comments etc. but only want SSO.

If you do user registration (sign-up) from WordPress, would wp-discourse also sync over user profile fields?

---

<div class="post-metadata">

### Author: ![Grex315](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grex315/32/115868_2.png) [@Grex315](https://meta.discourse.org/u/Grex315)
#### Post date: [April 12, 2015, 11:46am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/7 "2015-04-12T11:46:00Z")

</div>

Not by default. You would have to edit the plugin to pass the fields over in the payload and map them to fields in Discourse.

It only passes over the basic info, username, name, email, avatar url.

---

<div class="post-metadata">

### Author: ![franwess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franwess/32/115950_2.png) [@franwess](https://meta.discourse.org/u/franwess)
#### Post date: [April 12, 2015, 12:08pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/8 "2015-04-12T12:08:27Z")

</div>

Hi @Grex315, thanks for your response. Discourse is quite new to me so excuse the repeat of the question put I would like to fully wrap my head around it – does this mean that if a user registers is WP the basic info, username, name, email, avatar url. will be populated in Discourse as well, so that the user does not need to do it twice?

Thanks franwess

---

<div class="post-metadata">

### Author: ![Grex315](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grex315/32/115868_2.png) [@Grex315](https://meta.discourse.org/u/Grex315)
#### Post date: [April 12, 2015, 12:50pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/9 "2015-04-12T12:50:58Z")

</div>

That is correct. If the account is not there already it will be created. But it will only be created when they visit the discourse site and the sso session is called.

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [April 12, 2015, 2:43pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/10 "2015-04-12T14:43:24Z")

</div>

FWIW, in my environment (running wordpress on a highly optimized and slightly esoteric stack that includes HHVM, nginx with fastcgi-cache, redis object caching, etc) the SSO of the wp-discourse plugin does not work, whereas the PrimeTime SSO works perfectly. I spent a day trying to debug the issue with the wp-discourse plugin on my setup, but couldn’t figure it out. So I am using both for that reason.

It’s odd because when you dig into the code in both plugins, they are clearly based on the same original code. As far as I could tell, the wp-discourse plugin doesn’t seem to be correctly registering the hook/action for the function that is supposed to be handling the SSO requests coming from Discourse. I couldn’t figure out why.

There are others having the same issue. Here is a GitHub thread about it: [https://github.com/discourse/wp-discourse/issues/115](https://github.com/discourse/wp-discourse/issues/115)

---

<div class="post-metadata">

### Author: ![franwess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franwess/32/115950_2.png) [@franwess](https://meta.discourse.org/u/franwess)
#### Post date: [April 12, 2015, 3:30pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/11 "2015-04-12T15:30:34Z")

</div>

Hi @pjv thanks for the reply and your time to answer this, just as a matter of interest, does the Primetime SSO plugin also populate fields in Discourse when you register a user in WP?

In other words, if a user registers is WP, the basic info, username, name, email, avatar url. will be populated in Discourse as well, so that the user does not need to do it twice?

Does you then use the wp-discourse plugin for comments?

Regards  
@franwess

---

<div class="post-metadata">

### Author: ![franwess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franwess/32/115950_2.png) [@franwess](https://meta.discourse.org/u/franwess)
#### Post date: [April 12, 2015, 3:32pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/12 "2015-04-12T15:32:00Z")

</div>

Thank you @Grex315, the functionality will be sufficient for now. We will eventually have some other fields that must sync vice-verca but we can ammend the plugin for that.

Regards  
@franwess

---

<div class="post-metadata">

### Author: ![AdamCapriola](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adamcapriola/32/5192_2.png) [@AdamCapriola](https://meta.discourse.org/u/AdamCapriola)
#### Post date: [April 12, 2015, 4:00pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/13 "2015-04-12T16:00:51Z")

</div>

I am guessing these plugins are based on my code, so username, email, and display name will be sent over to Discourse when the user is initially created via SSO.

The main conundrum is that you need to keep the user’s email in sync on the Discourse side in the case that the user changes their email in WordPress. The email should update every time they log in with SSO (I think … I’d need to test this again), but if the user doesn’t (a) change email, (b) log out, and (c) log in again then their Discourse emails will be mailed to the old address.

There are ways to update the user’s email in Discourse immediately after it’s updated in WordPress (without having to log out and back in) but the solution is going to be dependent on what interface you’re using to let users update their email (front or back end).

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [April 12, 2015, 10:14pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/14 "2015-04-12T22:14:41Z")

</div>

indeed, @AdamCapriola, the code in both plugins looks like it is based on your gist.

the PrimeTime SSO plugin sends the same SSO package back to Discourse as the wp-discourse plugin does with one exception, the wp-discourse plugin sends the URL for the user’s wordpress avatar, but the PrimeTime plugin does not. @etc could easily add that bit if he wants, it’s just a single line of code.

reading this topic this morning made me go back and look at the plugins yet again and there definitely seems to be something messed up in how the wp-discourse plugin is instantiating itself in my wordpress environment. i stuck some logging statements inside the function that handles the [discourse SSO](https://meta.discourse.org/t/13045?silent=true) request and it just does not ever run. oddly though, the rest of the plugin’s functionality works fine for me.

yes, @franwess, i am using the wp-discourse plugin to have discourse supply comments beneath posts and pages in wordpress.

---

<div class="post-metadata">

### Author: ![franwess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franwess/32/115950_2.png) [@franwess](https://meta.discourse.org/u/franwess)
#### Post date: [April 13, 2015, 5:28am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/15 "2015-04-13T05:28:57Z")

</div>

Thank you @pjv for your trouble with this, I think we will continue with some testing in our environment but it seems that using both plugins might be an option.

Thanks @AdamCapriola, we will test this a bit further and report what we find, maybe it can help.

---

<div class="post-metadata">

### Author: ![etc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/etc/32/114717_2.png) [@etc](https://meta.discourse.org/u/etc)
#### Post date: [April 13, 2015, 4:16pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/17 "2015-04-13T16:16:51Z")

</div>

Other than the few lines pulled originally from @AdamCapriola’s excellent work, the implementation is quite different. The biggest difference is we’re intercepting the request directly rather than using a page template.

I’d be open to a PR on the PT plugin to add the profile picture sync capability.

Re: email syncing, how would that even work? How would Discourse know that the person signing in already has an account, but should have their email address updated?

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [April 15, 2015, 7:44pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/18 "2015-04-15T19:44:14Z")

</div>

I put up a PR for you to send avatars from WP to Discourse: [send avatar URL to discourse by pjv · Pull Request #1 · PrimeTimeCode/pt-wp-discourse-sso · GitHub](https://github.com/PrimeTimeCode/pt-wp-discourse-sso/pull/1)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [April 7, 2020, 5:23pm UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/19 "2020-04-07T17:23:36Z")

</div>

@etc, is the Primetime SSO plugin still maintained?

---

<div class="post-metadata">

### Author: ![etc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/etc/32/114717_2.png) [@etc](https://meta.discourse.org/u/etc)
#### Post date: [April 9, 2020, 1:28am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/20 "2020-04-09T01:28:12Z")

</div>

I haven’t pushed an update recently because there hasn’t been a PR or feature request, but it’s pretty foundational, and should still operate as expected.

---

<div class="post-metadata">

### Author: ![etc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/etc/32/114717_2.png) [@etc](https://meta.discourse.org/u/etc)
#### Post date: [May 15, 2020, 4:22am UTC](https://meta.discourse.org/t/using-primetime-sso-wp-discourse-plugin/27447/21 "2020-05-15T04:22:31Z")

</div>

@simon I’ve gotten word from a number of people that it is still working perfectly in their WP installations. We’re going to be adding some small features soon, I believe, so we’ll make sure it’s properly tested.
