How to redirect to different subdomain after login?

deadbydawn

Member
Hi all,

I am using the WP Bridge to use my xenforo users as authentication. This works great, but the only thing that doesn't work is: returning the user to the page they were on before they went to the login.

Before I keep digging through the various possibilities, I wanted to ask: does XF support this?

eg,
mysite.tld/site1/blog/ WP page, requires login to comment
forums.mysite.tld/ XF install location

Thanks!
 
You can specify the redirect location for a xenForo login form by adding a form field called redirect. For example, you can see the redirect form field in the default login form:

Admin CP -> Appearance -> Templates -> login_bar_form

Code:
			</dd>
		</dl>
	</div>

	<input type="hidden" name="cookie_check" value="1" />
	<input type="hidden" name="redirect" value="{$requestPaths.requestUri}" />
	<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />

</form>

The redirect location in this code is represented by {$requestPaths.requestUri}. If your login form doesn't have a redirect specified then you need to do that.
 
I have a bridge called XenWord that is on a different sub domain. When I visit this link: https://forums.mysite.com/login/?redirect_to=https://www.mysite.com

It always redirects me back to the forum root.

When inspecting the page, I just see this:

<input type="hidden" name="redirect" value="https://forums.mysite.com/">

Which template do I need to edit and what shall I add so that it will work in all login scenarios(Some people may login from a variety of origination pages)?

I've attempted to edit the helper_login_form, however I cannot find a way to redirect to external URLs.
 
Last edited:
As an update, the template you need to edit is helper_login_form(I believe that is what it is called).

However, this redirect only works for local directories. I had an addon made which accepts the redirect_to parameter from the WordPress XenWord bridge, and it will redirect to whatever page is called in the address bar's redirect_to parameter. If anyone is interested in this addon let me know. I'll try to get it working for logout as well.
 
Top Bottom