WordPress.org

Support

Support » Plugins and Hacks » Login and logout redirection

Login and logout redirection

Viewing 9 replies - 1 through 9 (of 9 total)
  • All i done is change the redirect to

    do_action(‘wp_logout’);

    $redirect_to = ‘redirect.php’;

    Then in redirect.php i put

    <?
    header (“Location: http://mydomain.com/index.php“);
    ?>

    Humph – I see how this would work but I’d prefer not to have to create another file (eg redirect.php in your example).

    I just need to work out which action to use for the logout redirection variable.

    Hello,

    I use two plugins working together to acheive a sophisticated login and redirect.
    Redirect Login

    and

    Themed login

    The result is clients can login on my front page, and are simply redirect into the client area of my website, without ever seeing the dashboard!

    d

    artfulalibi – yup, I have had a look at both of those plugins. Themed login overides some of the core WP finctionality, so I’m not so interested in that one. You can actually achieve something very similar WITHOUT compromising the updates rolled out to WP if you know what you are doing with templates.

    Redirect Login is interesting, but I couldn’t get it working right (WP v2.1.3)

    Really I was just trying to understand how to hook into the logout process, just like I have done for the login process in my example above, which I bundled into a simple plugin.

    Simply put – how do I redirect on logout, without hacking the core code. I’m tired of having to apply my hacks everytime a new update of WP is released!

    …just to make it clear, I want to bundle this function into a little plugin, rather than use someone elses code, I am trying to lift the lid on these WordPress Actions so I can learn more about the platform and PHP.

    No clues then on re-directing on logout?? I’m tearing my hair out trying to work this one out!

    Despite all my experimenting I still have not found out how to do this without modifying the core code. Modify redirect on login – yup, no problem (as shown in the example above) modify redirect on logout – I’d image would have worked the same but I can’t for the life of me work it out!!

    This seemed to get resolved (I think) in this:

    http://trac.wordpress.org/ticket/1239

    I am using WP2.1.3 install for testing this by the way. Why can’t I get $redirect_to to work with logout?

    tov3 your solution fixed my logout issues. Thank you so much. You cant even see the redirect page it loads so fast back to the index and im even on dialup!

    I used a combo of the login form i found on here a few bits here and a few there and now i have it when a user logs in the stay on the index page and when they logout they redirect back to the index page. works good for me and no plugin needed.

    Yep. I know it was five months ago, but t0v3’s solution is absolutely spot on. Perfect, in fact.

    If anyone’s reading this who wants a little more info about the solution, here’s how I implemented it:

    wrote this file in dreamweaver:

    <?
    header ("Location: http://mydomain.com/index.php");
    ?>

    Saved it as redirect.php and uploaded it to my theme folder (it doesn’t matter where you upload it, just as long as you can find it when you need it – see below)

    Then I went to my cPanel and modified the file called

    wp-login.php

    Only one line needed changing and that was line 78.

    t0v3 recommended changing it to:

    $redirect_to = 'redirect.php';

    But this will only work if you uploaded the file redirect.php to your root folder. I saved it my theme folder, so I had to stipulate the following directories:

    /wp-content/themes/stitched-10/redirect.php

    so line 78 looked like this:

    $redirect_to = 'http://www.mydomain.net/wp-content/themes/stitched-10/redirect.php';

    (that should all be on one line.)

    and then it worked!

    No hassle. No messing around in the theme’s other .php files. Just pure and simple.

    Thanks t0v3

    Good Work! 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Login and logout redirection’ is closed to new replies.
Skip to toolbar