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

Login From External Page Needs Redirect To Original Page

Discussion in 'XenForo Development Discussions' started by LPH, Jun 3, 2013.

  1. LPH

    LPH Well-Known Member

    I currently have the following in a WordPress child theme:

    PHP:
    echo '<span id="member" class="logIn_menu_class"><a href="http://community.tuxreportsnetwork.com/login" class="OverlayTrigger inner">Log In or Sign Up</a></span>
    What should I put in the href to get a redirect back to the current page? If I manually put something into the browser like the following ....

    PHP:
    http://community.tuxreportsnetwork.com/login?redirect=http://www.educlassics.com/wp-admin/[php]
     
    I get the community login but the redirect never happens.
     
    Any thoughts?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    LPH likes this.
  3. LPH

    LPH Well-Known Member

    Thank you. I'll try tonight.
     
  4. LPH

    LPH Well-Known Member

    OK. I'm stumped :(

    This is probably going to be so obvious that I'm going to be embarrassed but ... OK. So be it !


    PHP:

      
    <div id="xenlogin">
                <
    form action="http://community.tuxreportsnetwork.com/login/login" method="post" id="pageLogin">
               
                  <
    div class="ctrlWrapper">
                    <
    dl class="ctrlUnit">
                      <
    label for="LoginControl">Your name or email address:</label>
                      <
    input type="text" name="login" id="LoginControl" class="textCtrl" tabindex="101" />
               
                      <
    label for="ctrl_password">Password:</label></dt>
                      <
    input type="password" name="password" id="ctrl_password" class="textCtrl" tabindex="102" />
               
                      <
    input type="submit" class="button primary" value="log_in" tabindex="104" data-loginPhrase="log_in" data-signupPhrase="sign_up" />
                      <
    label for="ctrl_remember" class="rememberPassword"><input type="checkbox" name="remember" value="1" id="ctrl_remember" tabindex="103" /> stay_logged_in</label>
               
               
                  </
    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>
              </
    div>
     
     
      
    ');


    This obviously fails with the message:

    Code:
    The requested page could not be found.
    [URL]http://community.tuxreportsnetwork.com/$requestPaths.requestUri[/URL]
    

    My understanding is that $requestPaths.requestUri and $visitor .... are from XenForo which I can call from the WordPress theme ... if I knew how :)

    Any suggestions?

    Update: Let me give a few more details as I'm trying things. This code causes the WordPress page not to load.

    PHP:
                  <input type="hidden" name="redirect" value=" ' . $XF->visitor->get( 'requestPaths.requestUri' ) . ' " />
                   <
    input type="hidden" name="_xfToken" value=" ' . $XF->visitor->get( 'visitor.csrf_token_page' ) . ' " />
     
    Last edited: Jun 5, 2013
  5. LPH

    LPH Well-Known Member

    OK.

    Here is the code for the redirect to a current blog URL:

    PHP:
    <input type="hidden" name="redirect" value=" ' . get_permalink( $post->ID ) . ' " />
    I still need to work on the cookie issues because this is a multisite / multidomain configuration ....
     

Share This Page