Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect to last page after signin

Viewing 7 replies - 1 through 7 (of 7 total)

  • chrishajer
    Participant

    @chrishajer

    How about this:

    https://bbpress.org/forums/topic/heres-a-trick-to-redirect-user-back-to-topic-after-login#post-14268

    There was a hidden field with a name of “re” that you could use to redirect the user.

    Ah that looks really promising – I’ll try it out! Thanks so much. :-)

    Ah it looks like that code is for bbPress… it has a reference to bb_get_option in it:

    <input type=”hidden” name=”re” value=”<?php echo “http://&#8221;.$_SERVER.$_SERVER[“REQUEST_URI”].’?’.$_SERVER[“QUERY_STRING”]; ?>” />

    <input type=”hidden” name=”_wp_http_referer” value=”<?php echo bb_get_option( ‘uri’ ) ?>” />

    If I stick it into a WordPress template for my header.php file, it crashes… any ideas how to make it work in WordPress?


    chrishajer
    Participant

    @chrishajer

    Sorry, I thought you said you were routing all the logins through bb-login.php – this *is* bbPress code. Where do you need to use the code? What are you trying to do again?

    You’re sending all your users through bbPress for login, but when a blog user gets sent to the forum for login, they’re not returned to the page they were on, but to the forum front page? Is that accurate?


    chrishajer
    Participant

    @chrishajer

    This does not go in any WordPress files at all. It goes in your bbPress login-form.php template file, right before the closing </form> tag. That way, after submitting the form, bbPress directs the user back where they came from (all those SERVER VARIABLES in the code snippet.) I thought this did exactly what you were looking for. Where did you try to insert the code?


    _ck_
    Participant

    @_ck_

    You can do a similar hack on the wordpress side too, except it’s easier because wordpress doesn’t need a referer , you just do it in the url.

    ie.

    wp-login.php?redirect_to=<?php echo $_SERVER['REQUEST_URI']; ?>

    I stuck the code into bbPress in login-form.php, but it didn’t work.

    There’s a form on the WordPress side of things, in my WordPress header… I thought maybe that needed to be changed as well? It posts into the bbpress auth…

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar