How to setup admin redirect based on membership level on main site?

I am trying to setup a network function (multisite) that will check the user level (via the Membership plugin) and redirect if it is not that level. I have a basis for the code via https://premium.wpmudev.org/forums/topic/php-if-for-user-role-on-main-site#post-532116. I tried replacing $cap with $level_id and updating the level in the code with the correct ID but it still comes back with undefined variable for $level_id. Please let me know how I can modify the code from the plugin on https://premium.wpmudev.org/forums/topic/php-if-for-user-role-on-main-site#post-532116 to make this happen. Thank you.

  • Brian Durost
    • Recruit

    Thanks for sharing, but what I am referring to is when the mu user tries to access their website admin. They will have already been logged in and when they try to access their site admin it would redirect them to say an upgrade page if they aren’t on a certain membership level (via WPMUDev Membership plugin) as set on the main site (i.e. id=1).

  • PC
    • WPMU DEV Initiate

    Hey there Jason,

    Thanks for posting back.

    I am sorry but I am confused here.

    but what I am referring to is when the mu user tries to access their website admin. They will have already been logged in and when they try to access their site admin it would redirect them to say an upgrade page if they aren’t on a certain membership level

    How would they get a website in the first place if they are not on a certain membership level ?

    Or are you referring to the main site admin ?

    Can you kindly provide more clarity so that I can discuss with Eugene, our lead developer ?

    Cheers

    PC

    Sales &Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.