SSO dynamic login and registration redirect URL

Hi,

First of all thank you for building such an awesome plugin!

I set my WP as an SSO client and now every time someone logs in it redirects to the forum and after the login it redirects back to WP (as it is expected). But as I also use login to show restricted content to members, I’d like to redirect my users to the exact page or post they started their login process from where - as they are already singed in - I can show them the restricted content with my already set up plugin. Is this dynamic redirection achievable somehow?

It is also a problem with new registrations: they start on my site and after the registration is complete, they arrive to my forum. There should be a redirect to the page they arrived to the forum from.

Every help is much appreciated!

Hey there :slight_smile:

Yup, there’s a few ways to do this. It depends on how you’re inserting the login urls. The basic thing you need to do is to add the query parameter redirect_to to the sso url.

For example you can do this by using this structure

http://my-wordpress.com/restricted-content.php?discourse_sso=true&redirect_to=http://my-wordpress.com/restricted-content.php

If a user clicks on that url on your wordpress site they will initiate the SSO process, and when that completes, they will be redirected back to whatever was set after redirect_to=

2 Likes