Created
July 4, 2017 14:49
-
-
Save andrewlimaza/0f3fb8c74083ce8528f5a755a01a8004 to your computer and use it in GitHub Desktop.
Redirect users away from 'account' page in PMPro if they do not have a membership/logged-in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redirect user's to a new URL instead of the 'levels' page in PMPro. | |
* Add this code to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function redirect_users_to_a_new_page( $url ){ | |
return 'https://some-url.com'; //change this to the URL you would like to redirect your user's to. | |
} | |
//redirect if users do not have membership level. | |
add_filter( 'pmpro_account_preheader_redirect', 'redirect_users_to_a_new_page' ); | |
//redirect users if they not logged in at all. | |
add_filter( 'pmpro_account_preheader_no_user_redirect', 'redirect_users_to_a_new_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment