• Many folks online appear to be having difficulty with this so I’ve decided to share my solution:

    Add the following code to your theme’s functions.php file:

    // Plugin by http://wordpress.org/extend/plugins/peters-login-redirect/
    // Solution by http://www.dominornovus.com
    
    function login_widget_redirect( $empty, $redirect_to, $requested_redirect_to, $user )
    {
    // If the referring page contains "/forums/"...
    if (stripos($_SERVER['HTTP_REFERER'],'/forums/') !== false)
    {
    $referringpage = $_SERVER[HTTP_REFERER];
    return $referringpage;
    }
    //Otherwise, check the referring page contains "/blog/"...
    else if (stripos($_SERVER['HTTP_REFERER'],'/blog/') !== false)
    {
    $referringpage = $_SERVER[HTTP_REFERER];
    return $referringpage;
    }
    // Otherwise, default to the plugin's redirect settings...
    else
    {
    return false;
    }
    
    }
    
    add_filter( 'rul_before_user', 'login_widget_redirect', 10, 4 );

    This will effectively disable the plugin’s redirect settings anytime a user logs in from a forum or blog page. The standard wp-login.php page will inherit the plugin’s redirect settings.

    You can find a detailed explanation of the code at my blog:

    http://www.dominornovus.com/2011/11/14/restrict-peters-login-redirect-to-same-page-redirection/

Viewing 1 replies (of 1 total)
  • This is EXACTLY what I was looking for!! I wish this feature was already in the plugin cause it just makes sense that it would know to go back to the referring page after a login (or even an optional whitebranding page before forwarding you to the referring page… that’s the marketer in me talking lol). Thanks for this Dominor Novus!!

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Peter's Login Redirect] How to restrict to same page redirection for sidebar widget lo’ is closed to new replies.