1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to redirect to different subdomain after login?

Discussion in 'XenForo Questions and Support' started by deadbydawn, Feb 4, 2011.

  1. deadbydawn

    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!
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
    sweetpotato likes this.
  3. deadbydawn

    deadbydawn Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You will need to make sure that GET parameter makes it into the login form. You can access that parameter in the templates with {$_REQUEST.redirect}, but you should sanitize it first. This is better posted in the Development Questions forum.
     

Share This Page