Is there a method to direct a member of a custom membership band to their own custom landing page?

Is there a redirection method to direct a member of a custom membership band to their own custom landing page on sign in.

For example, if I have 3 memberships types:

Gold
Silver
Bronze

I would like each of these to get redirected to their own custom landing page when they sign in. Ie:

Gold members redirect to /gold-account
Silver members redirect to /silver-account
Bronze members redirect to /bronze-account

I can see a workaround using custom menus for each membership group whereby once they are signed in they see a My Account link that redirects them accordingly. But in this example they would all still share an initial common /my-account login page.

The actual use case is a bit more developed and could involve 20+ memberships and the above workaround would get very complex.

I am trying to create a solution whereby a Company can be added (as a Membership type) and their individual staff members then are assigned to that membership so they only see things available to their company. The things they can view would be indexed on a company specific custom account page - for everyone in that membership group to view.

Any suggestions about how to achieve this in a manageable way please?

Thanks
Chris

  • Nithin

    Hi chris,

    Hope you are doing good today. :slight_smile:

    Our developer would be able to give you a better idea regarding this, I'll ping the developer, and ask to give a look. Either myself or the developer will be keep you updated.

    Please do note that developers work round the clock, and have a slow response time. So it may take a little while for them to check this, and give a reply here.

    Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

  • Nithin

    Hey chris,

    I got a quick update regarding this, could you please try the following code, and check whether it works:

    add_filter( 'login_redirect', 'wpmudev_redirect_member', 10, 3 );
    function wpmudev_redirect_member( $redirect_to, $request, $user ){
    
        $user_id = @$user->ID;
        $member = MS_Factory::load( 'MS_Model_Member', $user_id );
        $membership_ids = $member->get_membership_ids();
        if( is_array( $membership_ids ) && !empty( $membership_ids ) ){
            foreach( $membership_ids as $m_id ){
                switch( $m_id ){
                    case 361 : $redirect_to = 'http://yourwebsite/link/'; break;
                    case 357 : $redirect_to = 'http://yourwebsite/link/'; break;
                    case 452 : $redirect_to = 'http://yourwebsite/link/'; break;
                }
            }
        }
        return $redirect_to;
    }

    The numbers 361, 357, 452 reflects the membership id, please change that to your membership id, and replace the link to your desired page. You can add the code either inside your child themes functions.php, or using a mu-plugins.

    I hope this works. Please let us know if you still need any further help. Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.