API: Determine Which Membership Level a Page Is Set To
Posted: June 13th, 2011, 5:03 pm
A site admin sets page/post 123 to Member Level X.
Within my theme templates, how do I programmatically determine what that value is? I see 'is_page_protected_by_s2member()' but I'm in need of something more like: 'page_membership_level() ' so that I can test for MembershipLevel 0 case as well as the NULL case.
I'm setting up some Drip Content logic and wondering how to access that info. Looked through the API but couldn't find an answer.
Loving this plugin so far! Working through it. Very impressed so far. Thank you!
Within my theme templates, how do I programmatically determine what that value is? I see 'is_page_protected_by_s2member()' but I'm in need of something more like: 'page_membership_level() ' so that I can test for MembershipLevel 0 case as well as the NULL case.
I'm setting up some Drip Content logic and wondering how to access that info. Looked through the API but couldn't find an answer.
- Code: Select all
// If page's membership level is NULL or level 0, define drip dates by when user became a free member
if ($page_membership_level >= 0) {
$days_since_member = S2MEMBER_CURRENT_USER_REGISTRATION_DAYS;
} else {
// If page's membership level is >= level 1, define drip dates by when user became a paying member
$days_since_member = S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS;
}
Loving this plugin so far! Working through it. Very impressed so far. Thank you!