PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

API: Determine Which Membership Level a Page Is Set To

s2Member Plugin. A Membership plugin for WordPress®.

API: Determine Which Membership Level a Page Is Set To

Postby skinnytires » 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.

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!
User avatar
skinnytires
Registered User
Registered User
 
Posts: 13
Joined: June 13, 2011

Re: API: Determine Which Membership Level a Page Is Set To

Postby Cristián Lávaque » June 14th, 2011, 2:37 am

Thanks for the kudos! It's great to know you're liking it. :)

About checking the restriction, why isn't that function enough? Here's the documentation for it viewtopic.php?f=40&t=9015&src_doc_v=110605#src_doc_is_page_protected_by_s2member%28%29

What exactly do you need?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: API: Determine Which Membership Level a Page Is Set To

Postby skinnytires » June 14th, 2011, 8:58 am

Hi Cristian - thanks so much for the reply.

Aarrgh. You are right! Shows I didn't read the full info:

"When/if the Page IS protected, the return array will include one of these keys ["s2member_(level|sp|ccap)_req"] indicating the Level #..."

Thanks much Cristian. I will try this out. Cheers.
User avatar
skinnytires
Registered User
Registered User
 
Posts: 13
Joined: June 13, 2011

Re: API: Determine Which Membership Level a Page Is Set To

Postby Cristián Lávaque » June 14th, 2011, 9:48 am

Cool. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron