Page 1 of 1

Disable Incremental Access

PostPosted: March 4th, 2011, 7:15 pm
by danv09
Hello.

Is there any way so every membership level can access only its content alone ?

Thanks.

Re: Disable Incremental Access

PostPosted: March 5th, 2011, 12:40 am
by Cristián Lávaque
Here's a lot of info on s2Member conditionals:

WP Admin -> s2Member -> API / Scripting

Example #3 under Using Advanced Conditionals answers your question pretty well:

Code: Select all
Example #3: Specific content for each different Member Level.

<?php if (current_user_is("s2member_level4")){ ?>
    Some premium content for Level 4 Members.
<?php } else if (current_user_is("s2member_level3")){ ?>
    Some premium content for Level 3 Members.
<?php } else if (current_user_is("s2member_level2")){ ?>
    Some premium content for Level 2 Members.
<?php } else if (current_user_is("s2member_level1")){ ?>
    Some premium content for Level 1 Members.
<?php } else if (current_user_is("s2member_level0")){ ?>
    Some content for Free Subscribers.
<?php } else { ?>
    Some public content.
<?php } ?>


You can also use a switch with an API constant, instead of the conditional function. Something like:

Code: Select all
switch S2MEMBER_CURRENT_USER_ACCESS_LEVEL {
    case 4:
        echo 'Some content for level 4 members.';
        break;
    case 3:
        echo 'Some content for level 3 members.';
        break;
    case 2:
        echo 'Some content for level 2 members.';
        break;
    case 1:
        echo 'Some content for level 1 members.';
        break;
    case 0:
        echo 'Some content for free members.';
        break;
    default:
        echo 'Some public content.';