I am using the Wordpress plugin for discourse, and I am wondering if there is a way of synchronising the logouts, as well as the logging in, to make things simpler for users.
At present, as I understand it, once users are logged in to the Wordpress site they can then navigate to the discourse forum, but have to click Login again - it would be simpler if this wasn’t necessary.
Also, it seems that logging out of either Wordpress or discourse doesn’t also log the user out of the other account. Would it be possible to implement this?
No, that setting is not enabled. I login to Wordpress, then follow a link to discourse, and I see this in discourse:
I have to click Log In on discourse, and then I’m automatically logged in:
But I’d rather my users didn’t have to take this extra step. Are you saying that they shouldn’t have to? I am not following a link to the discourse comments - I am just following a link to the home page of discourse. Not sure if this makes a difference.
Glad to hear that the synched logout is in the works!
The link from your homepage to your forum doesn’t have any SSO login information associated with it. At this point SSO login only works from Discourse topics. I’ve been meaning to add some WordPress shortcodes either to the wp-discourse plugin, or to a separate plugin that will do what you are looking for.
OK. Do you mean that when I click the ‘Start Discussion’ link below a blog post, this should carry the SSO login information over, as when I tried this as well, I still wasn’t logged in to discourse.
the sso login works as expected. The thing to do is to figure out why the link is being returned in the form that it is. I would expect the wp-discourse plugin to be returning it with a similar structure to the way I have edited it.
And I have tested the synchronised log out - it works when logging out of WordPress first, but not when logging out of discourse first. Is this the expected behaviour? Ideally I would like it to work both ways.
Hi there. I’m using Wordpress as an SSO client.
When I log out from Discourse, it logs me out from Wordpress thanks to the logout redirect parameter.
But when logging out of Wordpress, it doesn’t log out from Discourse. How can I achieve that?
I can add it as an option to the SSO Client settings. When WordPress is used as the SSO Provider, logging out from WordPress logs the user out of Discourse. With a slight modification, that same code will work for when WordPress is the SSO Client.
The easiest way to do that is to embed an SSO login link on your forum. You can get the format required for the link by viewing the page source code for the Login with Discourse link on your WordPress login page. You can probably embed the link without URL encoding the redirect parameter.
Something like this:
<a href="http://wpdiscourse.test/?discourse_sso=1&redirect_to=http://wpdiscourse.test/">Log in with Discourse</a>
No, but thanks for the reminder. I wrote the code for it, but didn’t add it to the main plugin yet. I’ll try to get it into an update that’s going out tomorrow.