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.

Conditional Statement

Home Forums Community Forum Conditional Statement

This topic contains 5 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years, 9 months ago.

Topic Author Topic
Posted: Thursday Mar 15th, 2012 at 1:42 am #8197

hello there :), I have 3 memberships the free, featured and premium. And I have a specific content available only for specific member and I want this kind of statement.

if user-membership is free then display this content, if user-membership is featured then display this content, else display this content..

is it possible using s2member?

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Thursday Mar 15th, 2012 at 4:30 am #8207

Hello Mark.

Yeah, it’s very possible.
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals -> Example #3[/hilite]

It’d be something like this:

[hilite pre_code]
[[s2If current_user_is(s2member_level1)]
Some content for Level 1 members.
[/s2If]]

[[s2If current_user_is(s2member_level0)]
Some content for Free members.
[/s2If]]

[[s2If !current_user_can(access_s2member_level0)]
Some public content.
[/s2If]]
[/hilite]

I hope that helps. :)

Posted: Thursday Mar 15th, 2012 at 9:29 pm #8307

Thank you so much! yehey! ..but what if the user is admin? the contents I used for the conditional are not visible to admin..

Posted: Thursday Mar 15th, 2012 at 10:02 pm #8310

Because neither of those conditions would be true for an admin. You’d have to modify the conditionals, or just go to the edit page to see them.

Posted: Thursday Mar 15th, 2012 at 10:28 pm #8313

so there is no if statement [if admin]? it’s ok if no, coz that’s not important anymore, its just so irritating that the admin can’t view the content that he created at the frontend.

Posted: Thursday Mar 15th, 2012 at 10:51 pm #8314

Yes, there is, that’s why I said you’d have to modify the conditionals. A simple [hilite mono]OR is_admin()[/hilite] added to each should do the trick.
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]

s2Member supports ALL Conditional Tags in WordPress®

I hope that helps. :)

Viewing 5 replies - 1 through 5 (of 5 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.