This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Restrict Results Based on Paid Memberships Pro Level

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Restrict Results Based on Paid Memberships Pro Level Reply To: Restrict Results Based on Paid Memberships Pro Level

#48538
bdkellybdkelly
Participant

We have our site set up kind of in reverse, where the post/page visibility isn’t restricted by the level, but the member is restricted from seeing content by their level. We have two categories of content, and users can see one, the other, or both depending on their subscription. So I’m not sure getting the access level of the post/page works, but will leave that to you and your expertise.

As I’m writing this out, I’m thinking we do have the posts/pages assigned to two different categories – A and B. Then PMPro determines what categories the membership level can access. Would pulling the category of the post/page and then checking it against the membership level work?

They do have a get membership level filter. Would this help?

pmpro_get_membership_level_for_user

Return the first active membership for a user.


/**
* Retrieves the first active membership for a user.
*
* @since 1.8.5.4
*
* @see pmpro_getMembershipLevelForUser
*
* @param object $level Level object.
* @param int $user_id The User ID.
*
* @return object $level Level object.
*/
apply_filters( ‘pmpro_get_membership_level_for_user’, $all_membership_levels[ $user_id ], $user_id );

Parameters

$level
object
$user_id
int

Return Value
$level

Source
File: https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/functions.php