Viewing 9 replies - 1 through 9 (of 9 total)
  • chaoskaizer

    (@chaoskaizer)

    try

    <?php
    $redirect = '&amp;redirect_to='.urlencode(wp_make_link_relative(get_option('siteurl')));
    $uri = wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' );
    ?>
    <a href="<?php echo $uri;?>"><?php _e('logout');?></a>

    Thread Starter schso

    (@schso)

    That’s great, thanks a lot.
    New request now this one is solved : I am in a post (no longer in the home page), how may I redirect where I am instead of the home page ?

    Thanks again, it’s much better now !

    Schso

    Thread Starter schso

    (@schso)

    Ice on the cake, I have the same redirection to do when I login from a post page.

    <p>Veuillez préciser votre nom et votre adresse mail. Vous pouvez vous connecter si vous êtes un membre du bureau de l’association.</p>

    I’d like to stay in the post page instead of going to the home page of the blog.

    It would be nicer this way, but it’s already gread.
    Thanks,

    Schso

    Thread Starter schso

    (@schso)

    oups sorry

    <p>Veuillez préciser votre nom et votre adresse mail. Vous pouvezvous connecter si vous êtes un membre du bureau de l’association.</p>`

    chaoskaizer

    (@chaoskaizer)

    use the following function to get the current url

    <?php
    function self_uri()
    {
    
        $url = 'http';
        $script_name = '';
    
        if (isset($_SERVER['REQUEST_URI'])):
            $script_name = $_SERVER['REQUEST_URI'];
    
        else:
            $script_name = $_SERVER['PHP_SELF'];
    
            if ($_SERVER['QUERY_STRING'] > ' '):
                $script_name .= '?' . $_SERVER['QUERY_STRING'];
    
            endif;
        endif;
    
            if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
                $url .= 's';
    
            $url .= '://';
    
            if ($_SERVER['SERVER_PORT'] != '80'):
                $url .= $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . $script_name;
    
            else:
                $url .= $_SERVER['HTTP_HOST'] . $script_name;
    
            endif;
    
        return $url;
    }
    //
    // $redirect = '&amp;redirect_to='.urlencode(self_uri());
    //
    ?>

    Thread Starter schso

    (@schso)

    Wow, everything’s just fine.
    You have been very helpful, thanks a lot.

    Schso

    That’s a great tip, thanks very much. Works perfectly in wp 2.7.1

    good , i will give it a try…..thanx

    which files and where do these lines of code go chaoskaizer?

    I missed something ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Redirection after logout’ is closed to new replies.