Hi there, just checking if someone is using Primetime Single Sign-on (PrimeTime WordPress + Discourse SSO – WordPress plugin | WordPress.org) with the wp-discourse plugin? Can these two co-exist happily with one another?
Thanks
What does the primetime sso plugin do that the wp-discourse plugin does
not?
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.
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?
But wp-discourse also provides sso so why install another plugin? Does primetime somehow do it better?
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.
thanks for the reply, I only saw now on the Github page that wp-discourse also does SSO 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?
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.
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
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.
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
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
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
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 © 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).
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 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.
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.
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?
I put up a PR for you to send avatars from WP to Discourse: https://github.com/PrimeTimeCode/pt-wp-discourse-sso/pull/1
@etc, is the Primetime SSO plugin still maintained?
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.
@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.