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?