Search

bbPress Showcase » WordPress Integration

Page "thank you" after after loggin ...

RSS
  1. 80giga
    80giga

    member
    Joined: Sep '09
    Posts: 13

    offline

    Hi,

    i use this login form in my wordpress to use bbpress login :

    <form class="login" method="post" action="forum/bb-login.php">
    <label>Username: <input name="user_login" type="text" id="user_login" size="13" maxlength="40" value="" tabindex="1" />
    </label>
    <label>Password: <input name="password" type="password" id="password" size="13" maxlength="40" tabindex="2" />
    </label>
    <input name="re" type="hidden" value="<?php echo $re; ?>" />
    <?php wp_referer_field(); ?>

    <input type="submit" name="Submit" id="submit" value="Log in »" tabindex="4" />
    <input name="remember" type="hidden" id="remember" value="1" tabindex="3" checked />
    </form>

    This will redirect me to the original page after login succes -> OK

    now, i need display thank you message after loggin like "thank you, clic here to return where you comming from" with link to referer page, else, it will redirect it to original page (with a http refresh ...)

    Posted 1 year ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    See the echo $re;

    Replace it with the url to your thank you page.

    Then pass the $re to the thank you and the thank you can forward them further.

    Posted 1 year ago #
  3. 80giga
    80giga

    member
    Joined: Sep '09
    Posts: 13

    offline

    Ok i edit my code like :

    <input name="re" type="hidden" value="http://www.monsite.com/thanks" />

    but when i add in my thanks page :

    <?php echo $re; ?>

    it do not show anythink !

    Posted 1 year ago #
  4. 80giga
    80giga

    member
    Joined: Sep '09
    Posts: 13

    offline

    i have creat on my wordpress blog a page called "thanks" with costum template :

    <?php
    /*
    Template Name: thank's
    */
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR">
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Merci !</title>
    </head>
    <body>

    <div id="contenu">
    <p>thank's for loggin.</p>
    </div>

    </body>
    </html>

    but in bb-login.php there is this function :

    // Get the referer.
    $ref = wp_get_referer();
    if ( !$re = $_POST['re'] ? $_POST['re'] : $_GET['re'] ) {
    $re = $ref;
    }

    so the hidden value of "$re" is used on bb-login.php to redirect to my thanks page, after that, "$re" is removed ...

    is there another solution ?

    Posted 1 year ago #
  5. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    You have to forward the $re

    <input name="re" type="hidden" value="/thanks?re=<?php echo $re; ?>" />

    Posted 1 year ago #
  6. 80giga
    80giga

    member
    Joined: Sep '09
    Posts: 13

    offline

    Thank's _ck_ !

    Ok here is my final code and it work !

    1) create a costum page in wordpress with costum template. exemple : create a blank page with url : http://www.monsite.com/thanks

    use this template :

    <?php
    /*
    Template Name: thank's
    */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR">
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="refresh" content="3;url=<?php echo $_GET["re"]; ?>">
    <title>Merci !</title>
    </head>
    <body>
    <div style="text-align:center">
    Merci de vous être connecté !

    <p>Vous allez être rediriger automatiquement vers la page d'ou vous venez ...</p>

    <p>Si votre navigateur ne vous redirige pas automatiquement ">cliquez ici.</p>
    </div>
    </body>
    </html>

    2) create a template called "my_login.php" with the following code and upload it on your wordpress theme :

    <form class="login" method="post" action="http://www.monsite.com/forum/bb-login.php">
    <label>Username: <input name="user_login" type="text" id="user_login" size="13" maxlength="40" value="" tabindex="1" />
    </label>
    <label>Password: <input name="password" type="password" id="password" size="13" maxlength="40" tabindex="2" />
    </label>
    <input name="re" type="hidden" value="http://www.monsite.com/thanks?re=<?php echo get_permalink(); ?>" />
    <input type="submit" name="Submit" id="submit" value="Log in »" tabindex="4" />
    <input name="remember" type="hidden" id="remember" value="1" tabindex="3" checked />
    </form>

    finaly call this template on your header.php like :

    <?php
    function wt_get_user_name()
    {
    global $userdata;
    get_currentuserinfo();
    return $userdata->user_login;
    }

    if ( is_user_logged_in() ) {
    echo 'Welcome ' . wt_get_user_name();
    } else {
    include (TEMPLATEPATH . '/my_login.php');
    };
    ?>

    All done

    Posted 1 year ago #
  7. 80giga
    80giga

    member
    Joined: Sep '09
    Posts: 13

    offline

    A last question : do you think if there are some Security vulnerabilities in my code ?

    Posted 1 year ago #
  8. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    It should be safe since it's not writing anything anywhere.

    Posted 1 year ago #

RSS feed for this topic

Post a reply to “Page "thank you" after after loggin ...”

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
32 users online from in the past 30 minutes. 15 bots 17 guests
7,414 views today 8,426 yesterday 16,043 peak. Most at once 50 today 62 yesterday 131 peak. Visited today: Amylawrence, guava, JeffreyCasivant, wigbuy123, gdfddfs, nandao, _ck_, summerfortun
2,288 posts in 394 topics over 66 months by 430 of 2,167 members. Latest: watchessaleus, wigbuy123, JeffreyCasivant