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™

conditional tags do not work

s2Member Plugin. A Membership plugin for WordPress®.

conditional tags do not work

Postby buddy101 » April 19th, 2011, 5:52 pm

Hello,

Conditionals with s2If do not seem to work for me for some reason. Here is what I tried -

1. i changed the post access restriction from level0 to blank (using level 0 only for now)
2. added the following after the more tag in html view

Code: Select all
[s2If !current_user_can(access_s2member_level0)]
If you wish to read further, you would need to be a <strong>[s2Get constant="S2MEMBER_LEVEL0_LABEL" /]</strong>. <a href="[s2Get constant="S2MEMBER_LOGIN_PAGE_URL" /]">Login</a> to your account or if you have not registered with us yet, feel free to <a href="[s2Get constant="S2MEMBER_LOGIN_PAGE_URL" /]?action=register">register</a> to gain access to this content.
[/s2If]


[s2If current_user_can(access_s2member_level0)]
Protected content goes here.
[/s2If]


3. When I access the post as a guest, I can see both Protected content and the prompt to register (which would suggest both ifs are succeeding !!). Sometimes I get redirected to membership options page as if there was a post level restriction.
User avatar
buddy101
Registered User
Registered User
 
Posts: 3
Joined: March 24, 2011

Re: conditional tags do not work

Postby Cristián Lávaque » April 19th, 2011, 8:55 pm

Hi buddy. :)

That's weird. OK, try using the current_user_cannot function instead then:

Code: Select all
[s2If current_user_cannot(access_s2member_level0)]
...
[/s2If]


I'd also suggest you take a look at the alt. views protection setting. WP Admin -> s2Member -> General Options -> Alternative Views Protection

And watch this video, it may help you with this: http://www.s2member.com/content-restric ... ble-video/

If you still have trouble with this, please post a screenshot of your content protection panels from General Options.
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

Re: conditional tags do not work

Postby buddy101 » May 3rd, 2011, 10:06 pm

I tried
Code: Select all
current_user_cannot
instead of
Code: Select all
!current_user_can
, it still does not seem to work. Both
Code: Select all
current_user_cannot
and
Code: Select all
current_user_can
seem to be satisfied on the protected content. This may be a bug triggered if the content was at some point protected at post level and now being switched to conditional protection ? I have no idea what is going on.
User avatar
buddy101
Registered User
Registered User
 
Posts: 3
Joined: March 24, 2011

Re: conditional tags do not work

Postby Cristián Lávaque » May 3rd, 2011, 11:43 pm

Got it.

Could you post the actual code you tried to protect the content?

And could you please post screenshots of the access restriction panels in your General Options page? WP Admin -> s2Member -> General Options
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

Re: conditional tags do not work

Postby buddy101 » May 13th, 2011, 10:42 am

I have sent screenshots to Jason, you should be getting them shortly.
User avatar
buddy101
Registered User
Registered User
 
Posts: 3
Joined: March 24, 2011

Re: conditional tags do not work

Postby Jason Caldwell » May 13th, 2011, 4:21 pm

Thank you. Investigating now.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 1 guest

cron