• Resolved admiralchip

    (@admiralchip)


    Hello,

    I’ve got a free subscription that expires after some time. I would like to redirect an expired member to a page called “Renew” instead of the membership levels page. I intend to keep the membership levels page for new users who have not registered and subscribed. How do I go about this?

    Thanks in advance!

    P.S.
    I only have one subscription level.

    https://www.ads-software.com/plugins/paid-memberships-pro/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter admiralchip

    (@admiralchip)

    Alright, after playing around with the code and searching for possible solutions here’s what I found. I’ve not yet completely solved my problem (so the topic is not yet resolved!) but I hope that this might be of some use to others.

    I saw this while going through Jason’s github page:

    https://gist.github.com/strangerstudios/7bbf6b2b21a9a0518a44

    so I tweaked it a bit. Here’s what I got:

    function coming_soon_redirect()
    {
    global $pagenow;
    
    if(function_exists('pmpro_hasMembershipLevel') && !pmpro_hasMembershipLevel() && !is_page("login") && !is_page("133") && $page_now != "wp-login.php")
    {
        wp_redirect(home_url("?page_id=133")); // I used a page id
        exit;
    }
    }
    add_action('template_redirect', 'coming_soon_redirect');

    This redirects non-members (an expired member) to a renew page. It actually works (just in case anyone wants to use it) however, it does not let them have access to any OTHER page like the home page, a portfolio page, etc.

    I’d like non-members to be able to access some other pages as well. I tried following the example given for “redirect non-users to coming soon page, but allow certain other pages” (that’s on line 48 in the above link) but I’m not getting it right. I’m not using slugs for my pages and posts because I set the permalink to default. I tried using slugs but that didn’t work either. Each time I try to make an array of okay pages and put them in my code I end up with a redirection loop and it doesn’t work.

    Does anyone know a way around this?

    Thread Starter admiralchip

    (@admiralchip)

    Does anyone know a way? I still need help.

    Thread Starter admiralchip

    (@admiralchip)

    Alright, I’ve figured a way around it. I thought I’d write what I eventually did just in case someone else wants to do the same.

    I ended up removing the [pmpro_levels] short code from the membership levels page and editing the content of the page. The page is still a subset (for lack of a better word lol) of the “membership account” page. Since I only have one membership level (1), I figured it wasn’t necessary for a new user to have to select the membership level themselves so I just sent them directly to the page for that membership level thus eliminating the need for them to see a membership levels page. This works quite nicely for me. Hope this helps someone.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirecting an expired member to a page other than to the Membership levels page’ is closed to new replies.