• Resolved mksauce23

    (@mksauce23)


    I was using a plugin called “Redirect After Login” to set up unique redirects based on what the user’s role was who logged in. However after installing WP-Members, this plugin doesn’t seem to work anymore. Is there a way I can customize the redirect within WP-members based on the role given to the user?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can add something like the following to your theme’s functions.php file (or ideally your custom child theme):

    function my_login_redirect( $redirect_to, $user_id ) {
        // return the url that the login should redirect to
        return 'https://www.mywebsite.com/myredirecturl/';
    }
    Plugin Author Chad Butler

    (@cbutlerjr)

    I don’t know anything about that particular plugin, but whether it would work or not depends on how it applies its redirects. If it is hooking to a WP action like wp_login, then it should continue to work. Since I don’t know what it is doing, I can’t really answer that.

    However, I can say that WP-Members does have a direct filter hook that can be used – wpmem_login_redirect:

    https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_login_redirect

    Also, you could hook to the WP wp_login action which comes after the user is set as logged in. A user can be redirected at that point as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unique Login Form Redirects Based on Member’ is closed to new replies.