Page 1 of 1

Simple Conditionals

PostPosted: October 27th, 2011, 7:16 am
by reallysimpleseo
Hi there,
I have been using simple conditionals to enable people to access more of a post depending on their membership level. Now I want to use nested conditional (or I think I do) to go a little further. Basically I want to post access to work as below:

First part of post content available to anyone.

Content for subscribers at level 0

Content for Level 1

----
The way I have been trying to do this is as:

First part of post content available to anyone.

[s2If is_user_logged_in()]

Content for subscribers at level 0

[s2If !is_user_logged_in()]Join as a free member to read more.[/s2If]

[s2If current_user_can(access_s2member_level1)]

Content for Level 1

[/s2If] [s2If !current_user_can(access_s2member_level1)]
Join at Level 1.
[/s2If]

This doesn't seem to work as it just brings up the Level1 option. I'm sure it's simple but I just can't get my head around the correct conditionals. If you could just show me the correct conditionals for this, it would be most helpful.
Many thanks
David

Re: Simple Conditionals

PostPosted: October 27th, 2011, 8:15 am
by Eduan
Have you tried Advanced / PHP Conditionals?

Re: Simple Conditionals

PostPosted: October 27th, 2011, 8:29 am
by reallysimpleseo
Hi, eduan, Thanks for the comment. I haven't, mainly because I don't really know anything about PHP and was hoping to do it with simple conditionals instead.

Re: Simple Conditionals

PostPosted: October 27th, 2011, 8:32 am
by Eduan
Well, atleast try, it's really easy, even I that don't code PHP learned them.

Re: Simple Conditionals

PostPosted: October 27th, 2011, 8:41 am
by reallysimpleseo
Thanks, I'll give it a try.

Re: Simple Conditionals

PostPosted: October 28th, 2011, 11:01 pm
by Cristián Lávaque
Advanced conditionals are better, but you can still do it with simple ones like you tried. You were missing the closing tag for the first condition. Try it like this:

Code: Select all
First part of post content available to anyone.

[s2If !is_user_logged_in()]
Join as a free member to read more.
[/s2If]

[s2If is_user_logged_in()]
Content for Level 0.
[/s2If]

[s2If !current_user_can(access_s2member_level1)]
Join at Level 1.
[/s2If]

[s2If current_user_can(access_s2member_level1)]
Content for Level 1.
[/s2If]


Let me know if that helps. :)