• i’ve been struggling with this for days, hope someone can help:

    already logged in users are shown a ‘you are already logged in’ message if they try to log in again. this is generated from #36 in wpdm-login-form after an is_user_logged_in. i want to replace this, to redirect already-logged-in users to a custom page of my own; in part, because i don’t want to use the wpdm user dashboard. at all. i have everything else working the way i want, and all my other redirects work well with the peter’s login redirect plugin. this, though, i can’t get to work.

    i’ve tried all sorts of snippets in functions.php, in wpdm-functions.php, and wpdm-login-form itself. i get get 404, a blank ‘login’ page, locked out of the site, or no change at all. i’m using wpdm free and i’m not much of a php’er.

    any help would be greatly appreciated.

    https://www.ads-software.com/plugins/download-manager/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Shahriar Alam

    (@shahriar0822)

    Add following code in your theme’s functions.php file.

    add_action( 'template_redirect', 'wpdm_login_redirect' );
    function wpdm_login_redirect(){
        if( is_user_logged_in() && get_the_ID() == get_option('__wpdm_login_url') ):
            wp_redirect( home_url('/') );
            exit();
        endif;
    }

    You have replace the home_url('/') with your own url you want to redirect to. It now redirects to homepage.

    Thread Starter wheeleran

    (@wheeleran)

    thank you very much! I was confused by the colon at the end of #3 – code block? – and didn’t realize how it could work… till it did. much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to redirect already logged in users’ is closed to new replies.