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.

simpel shortcode conditionals

Home Forums Community Forum simpel shortcode conditionals

This topic contains 12 replies, has 2 voices. Last updated by  m tim 3 years ago.

Topic Author Topic
Posted: Friday Dec 27th, 2013 at 10:32 am #62164
m tim
Username: mtim

Hello
can someone help me with the following, which I’m working on for weeks.
I have little technical knowledge and understanding of codes.

My problem is the following:
I want to sell three separate courses, so:
level 1
level 2
level 3

These are three separate courses.
Which may have level 1 to level 2 and level 3. Access
Level 2 should have two to level 1 and level3 access
and Level 3 must not have access to level 1 and level 2

Level 4 should be a course where you have access to Level 1, 2 and 3. all courses so.

Now I have everything figured out and would be for me the only option to get simple shortcodes conditionals have this working.

Now my question:
what code I need for level 1,2,3 and 4?
And where I place?

I hope someone has the solution, and I want to explain. Step by step

I would like to hear from you
greetings Marjan

List Of Topic Replies

Viewing 12 replies - 1 through 12 (of 12 total)
Author Replies
Author Replies
Posted: Friday Dec 27th, 2013 at 1:13 pm #62169
cassel
Username: cassel

Hi Marjan,

This will be pretty simple once you get the hang of it. The “problem” is using the Levels make things confusing because S2Members creates levels to be cumulatives, but if you don’t want them cumulative, you should use ccaps – Custom Capabilities (even if you call them LEVELS).

Let’s say you have content A, B, C, D, E, F
Content A and B is for anyone who has LEVEL1 ccap
Content C and D is for anyone who has LEVEL2 ccap
Content E and F is for anyone who has LEVEL3 ccap

So you will protect Content A within these shortcodes:

[s2If current_user_is(s2member_level1)]
   Content A or B and will be accessible only to Members with LEVEL1 ccap.
[/s2If]
[s2If current_user_is(s2member_level2)]
   Content C or D and will be accessible only to Members with LEVEL2 ccap.
[/s2If]

Now, since a member cannot be at more than one level, that is why you will include the LEVEL as a ccap instead. So in your Paypal button, you will have LEVEL1 or LEVEL2 or LEVEL3 included. If you want a member to purchase the content to more than one level, then you include all of them like LEVEL1,LEVEL2,LEVEL3 in the ccap.

So what you call LEVEL4, does not need to have its own ccap since LEVEL4 = LEVEL1+LEVEL2+LEVEL3 so since the member will get all those levels in their ccaps, they will be able to access the content you protected with the shortcodes.

Does that seem clearer?

Posted: Friday Dec 27th, 2013 at 1:34 pm #62170
m tim
Username: mtim

Hello

Thanks for your reply.

I can not just use it because I do not work with paypal.
I work with the PRONAMIC ideal plugin.
Incase this plugin I can not create the payment buttons.
said advised me to work. shortcode with simple conditional

But how?

Posted: Friday Dec 27th, 2013 at 1:41 pm #62171
cassel
Username: cassel

I don’t know that payment system, but how do you include levels or ccaps for this payment system?

Posted: Friday Dec 27th, 2013 at 1:54 pm #62174
m tim
Username: mtim

I sell the course once, so no monthly subscription.
Each course I make an ideal payment button. the ideal payment button is independent of the various courses.
I have to work with these codes levels:
[s2If current_user_is (s2member_level2)]
     Some premium content for Level 2 Members.
[/ s2If]

[s2If current_user_is (s2member_level1)]
     Some premium content for Level 1 Members.
[/ s2If]

[s2If current_user_is (s2member_level0)]
     Somecontent for Free Subscribers.
[/ s2If]

But here I do not understand much of it, it is probably very simple …….

Posted: Friday Dec 27th, 2013 at 2:03 pm #62176
cassel
Username: cassel

Well, if you can set the member’s level, then you can use this code:

[s2If current_user_is(s2member_level3)]
    Some premium content for Level 3 Members.
[/s2If]

[s2If current_user_is(s2member_level2)]
    Some premium content for Level 2 Members.
[/s2If]

[s2If current_user_is(s2member_level1)]
    Some premium content for Level 1 Members.
[/s2If]

but since you want some members to have access to more than one level content, you would have to add something like this too:

[s2If current_user_is(s2member_level4) OR current_user_is(s2member_level3) OR current_user_is(s2member_level2) OR current_user_is(s2member_level1)]
    Some premium content that can be accessed by various level members
[/s2If]

This is a little bit more coding that I personally like but it is still feasible. Would that work?

Posted: Friday Dec 27th, 2013 at 3:47 pm #62181
m tim
Username: mtim

ok, I have been told that I had to apply indeed this.

Now I not only know what code I need to place true.
Should it be so?
level 1
[S2If current_user_is (s2member_level1)]
     Some premium content for level 1 members.
[/ S2If]

level 2

[S2If current_user_is (s2member_level2)]
     Some premium content for Level 2 members.
[/ S2If]

level 3
[S2If current_user_is (s2member_level3)]
     Some premium content for Level 3 members.
[/ S2If]

level 4
[S2If current_user_is (s2member_level4) OR current_user_is (s2member_level3) OR current_user_is (s2member_level2) OR current_user_is (s2member_level1)]
     Some premium content that can be accessed by different members level
[/ S2If]

Paste am, just as an example, the code for level one on each page (I only work with pages) in level 1?

And how can I test this?

Posted: Friday Dec 27th, 2013 at 3:50 pm #62182
cassel
Username: cassel

You can test it by creating a test user, give the user a level and check. Use different browsers for you, the admin, to give the access, and the test user to try it.

Posted: Friday Dec 27th, 2013 at 4:00 pm #62183
m tim
Username: mtim

ok to test it it is clear.
and the rest?
Do I need the codes as I have described above as well as places?

Posted: Friday Dec 27th, 2013 at 4:05 pm #62184
cassel
Username: cassel

You need to put that code for all the content you want to protect.
Whatever will be inside the shortcodes, will be reserved for only the members who have the level access you determined.
You can test with your test member with different levels and see if the member can access all the content it should see, and NOT see the other content.
Then, you should be ok.

Posted: Friday Dec 27th, 2013 at 4:18 pm #62185
m tim
Username: mtim

so that

level 1
[S2If current_user_is (s2member_level1)]
      Some premium content for level 1 members.
[/ S2If]

level 2

[S2If current_user_is (s2member_level2)]
      Some premium content for Level 2 members.
[/ S2If]

level 3
[S2If current_user_is (s2member_level3)]
      Some premium content for Level 3 members.
[/ S2If]

level 4
[S2If current_user_is (s2member_level4) OR current_user_is (s2member_level3) OR current_user_is (s2member_level2) OR current_user_is (s2member_level1)]
      Some premium content That can be accessed by different members level
[/ S2If]

sorry but I’ve never done this before and would like to know for example if I do it well …

Posted: Friday Dec 27th, 2013 at 4:27 pm #62186
cassel
Username: cassel

I think it looks good.
Did you try it with the test user at different level?

Posted: Friday Dec 27th, 2013 at 4:35 pm #62187
m tim
Username: mtim

ok thank you so much, I can get to work. And I do it as described above.
Thank you!

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