Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

auth_redirect() doesn’t send users back

$
0
0

Replies: 0

For the login form, I used the default wp_login_form input names, and the default value for the hidden type input named redirect_to which is: ( is_ssl() ? ‘https://’ : ‘http://’ ) . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’] .

for some pages, I want user to login to access to them, so I use the auth_redirect() function, as expected it sends users to the login page, but after login, doesn’t send them back to the page they were originally.

So I tried to filter the login_redirect… but it doesn’t work. Thanks for your help!

function my_login_redirect_function(){
    if(( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] == get_bloginfo('url').'/login'){
            return get_bloginfo('url').'/dashboard';
        }else{
            $urlStartPos= strstr($_SERVER['REQUEST_URI'], 'http');
            return(urldecode($urlStartPos)); 
        }
add_filter('login_redirect','my_login_redirect_function');

Viewing all articles
Browse latest Browse all 59525

Trending Articles