Created
July 16, 2015 15:48
-
-
Save strangerstudios/6b1da218e5fad3baee9f to your computer and use it in GitHub Desktop.
Restrict access to certain pages based on a user meta value.
This file contains 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
/* | |
Users with the upsell usermeta have access to everything. | |
*/ | |
function my_pmpro_has_membership_access_filter($hasaccess, $mypost, $myuser, $post_membership_levels) | |
{ | |
$upsell = $myuser->upsell; | |
if(!empty($upsell)) | |
{ | |
//could also check that $mypost is a specific page or in a specific group of pages here | |
$hasaccess = true; | |
} | |
return $hasaccess; | |
} | |
add_filter('pmpro_has_membership_access_filter', 'my_pmpro_has_membership_access_filter', 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment