latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Access Member Level and Subscription Info

Home Forums Community Forum Access Member Level and Subscription Info

This topic contains 3 replies, has 2 voices. Last updated by  Eduan 4 years, 4 months ago.

Topic Author Topic
Posted: Saturday Sep 8th, 2012 at 12:21 pm #24648
Steve G
Username: steveg

If I have a membership level 1 with monthly and yearly subscriptions, what PHP code or shortcode(s) do I need for something like the following?

if((member_level === 1) && (member_subscription === "monthly")){
  // Do Something
} . . .

It seems that I can test the level with

current_user_is("s2member_level1")

or

[s2If current_user_is(s2member_level1)]

How do I test the subscription?

Thanks.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Saturday Sep 8th, 2012 at 12:40 pm #24649
Eduan
Username: Eduan
Moderator

You can use this:

[s2If current_user_is(s2member_level1)]
  Content exclusively for members level 1.
[/s2If]

If you’re gonna use it inside code, then you will have to use the PHP version:

<?php if(current_user_is('s2member_level1')) { ?>
  Content exclusively for members level 1.
<?php } ?>

Hope this helps. :)

Posted: Saturday Sep 8th, 2012 at 1:00 pm #24650
Steve G
Username: steveg

Thanks, but how do I test for a subscription, such as monthly or yearly?

Posted: Saturday Sep 8th, 2012 at 2:01 pm #24654
Eduan
Username: Eduan
Moderator

This isn’t possible if I’m not mistaken.

One workaround for this is to use custom capabilities (ccaps for short), and have the button give a different ccap depending on the lenght of the subscription.

You can check out custom capabilities under Dashboard -› s2Member® -› API / Scripting -› Custom Capabilities, here’s a video about them: Video » s2Member (Custom Capabilities)

Hope this helps. :)

Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.