• When I try to log out using this widget, I get an error 404 not found. I have identified that it’s this line causing the problem in alw_template.php:

    <?php echo wp_logout_url('/wp-login.php?action=logout&redirect_to=' . $_SERVER['REQUEST_URI']); ?>">

    My WordPress is installed in a sub-directory and so /wp-login.php is not found. I have modified the code to

    <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>

    That seems to do the trick. Thought I would save some time for anyone else trying to use the plugin.

    Dalton

    https://www.ads-software.com/extend/plugins/ajax-login-widget/

Viewing 4 replies - 1 through 4 (of 4 total)
  • hi,

    i’m not good with coding – where do i place the above code?

    thanks in advance – Mark

    all sorted thanks – learning more and more about this wordpress stuff!!

    Dalton Rooney’s fix did correct the error, but did not leave me on the page I was viewing when I logged out. (And isn’t that the BIGGEST reason we all want this plugin?? ?? )

    For example I was viewing a blog category page and if I logged out while there in stead of staying on the page I was on, I was redirected to the post page for the 1st post in the category I was viewing.

    So following some info I found here:
    https://codex.www.ads-software.com/Function_Reference/get_permalink

    I made the following changes to the file

    ajax-login-widget/alw_template.php

    .
    .
    .
    Find this (it’s towards the end of this file):
    (<a href="<?php echo wp_logout_url('/wp-login.php?action=logout&redirect_to=' . $_SERVER['REQUEST_URI']); ?>">log out</a>)
    .
    .
    .
    Change to:
    (<a href="<?php echo esc_url( wp_logout_url( $_SERVER['REQUEST_URI'] ) ); ?>">log out</a>)
    .
    .
    .
    This will fix the logout error and leave you on the page you were viewing when you log out. Hope that helps someone.. I really like this plugin, but I fear it’s starting to show signs of it’s age after not being updated in nearly 2 years.. ??
    .
    .
    .

    Edited to add: I am using this posted fix with WordPress v3.2.1 in case anyone is interested..

    bhomatude

    (@bhomatude)

    I was having a similar problem with logging out, but needed a redirect to a certain page… Here is a link that explains it all!

    Default Usage

    <a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout</a>

    Logout and Redirect to Current Page

    <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>

    Logout and Redirect to Homepage

    <a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Logout</a>

    Logout and Redirect to Another Site

    If you are using wp_logout_url to redirect to another site on logout (e.g. another subsite in a MultiSite network) you’ll need to make use of the allowed_redirect_hosts filter

    add_filter('allowed_redirect_hosts','allow_ms_parent_redirect');
    function allow_ms_parent_redirect($allowed)
    {
        $allowed[] = 'multisiteparent.com';
        return $allowed;
    }
    
    <a href="<?php echo wp_logout_url( 'https://multisiteparent.com' ); ?>" title="Logout">Logout</a>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: AJAX Login Widget ] Errors when logging out’ is closed to new replies.