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.

Check an API contant value using [s2If]

Home Forums Community Forum Check an API contant value using [s2If]

This topic contains 2 replies, has 2 voices. Last updated by  James Hollis 4 years, 6 months ago.

Topic Author Topic
Posted: Wednesday Jul 4th, 2012 at 11:19 am #18301

Is there a way to check an API constant value inside the [s2If] conditional?

I allow level 0 members to download two (2) protected resources. If they exceed that, I would like to offer them ability to pay for the resource using custom capabilities and provide them the download link to the file in the level0 protected file area.

Is there a way to check the value of S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED inside a [s2If] conditional so I can display right download link?

Cheers!

Jim

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Thursday Jul 5th, 2012 at 4:13 am #18361
Raam Dev
Username: Raam
Staff Member

Hi Jim,

The [s2If] shortcode was a feature added by s2Member for very basic conditionals. I don’t believe it’s possible to check a value inside it the way you want to.

However, you can certainly install a plugin like Exec-PHP and then use a snippet of PHP code in place of the [s2If] shortcode:

<?php if (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED == 0) { ?>
Sorry you're not allowed to download.
<?php } else { ?>
Yes, downloads are allowed.
<?php } ?>
Posted: Thursday Jul 5th, 2012 at 8:33 am #18375

Thanks for the response! I’m trying to avoid using php wherever I can. Your shortcodes are a true blessing and have allowed me to do almost everything without php.

Cheers!

Jim

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