PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Simple Conditionals

s2Member Plugin. A Membership plugin for WordPress®.

Simple Conditionals

Postby reallysimpleseo » October 27th, 2011, 7:16 am

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
User avatar
reallysimpleseo
Registered User
Registered User
 
Posts: 23
Joined: August 18, 2011

Re: Simple Conditionals

Postby Eduan » October 27th, 2011, 8:15 am

Have you tried Advanced / PHP Conditionals?
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: Simple Conditionals

Postby reallysimpleseo » October 27th, 2011, 8:29 am

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.
User avatar
reallysimpleseo
Registered User
Registered User
 
Posts: 23
Joined: August 18, 2011

Re: Simple Conditionals

Postby Eduan » October 27th, 2011, 8:32 am

Well, atleast try, it's really easy, even I that don't code PHP learned them.
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: Simple Conditionals

Postby reallysimpleseo » October 27th, 2011, 8:41 am

Thanks, I'll give it a try.
User avatar
reallysimpleseo
Registered User
Registered User
 
Posts: 23
Joined: August 18, 2011

Re: Simple Conditionals

Postby Cristián Lávaque » October 28th, 2011, 11:01 pm

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. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron