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.

[s2 if current user ..] not working?

Home Forums Community Forum [s2 if current user ..] not working?

This topic contains 5 replies, has 2 voices. Last updated by  Cristián Lávaque 3 years, 10 months ago.

Topic Author Topic
Posted: Tuesday Feb 26th, 2013 at 9:05 am #43231
Thomas
Username: tomrail

Hello,

i have membership sites protected to be visible by level0 members.

Inside that page need to display different information based on membership level.

Wanted to use:

[s2If current_user_is(s2member_level3) OR current_user_is(s2member_level4)]
L3 and L4 content
[/s2If]

Somehow does not work. Blank space.

Tried

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

..also does not work. Content is there if shortcode is removed, and content is invisible once shortcode is placed.
Retrieving of e.g. [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /] works fine.

Above shortcodes i -of course- tried with levels that reflect my own level (=l4).

Is there anything that could possibly block the s2m protection? How to find out?

Thank you!

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Wednesday Feb 27th, 2013 at 7:50 am #43294

Hi Thomas.

Where you testing these conditionals logged in as the admin? If so, that’d explain it. Your conditionals above check if the user has that exact level, not if he can access that level’s content: [hilite mono]current_user_is(s2member_level1)[/hilite] vs. [hilite mono]current_user_can(access_s2member_level1)[/hilite].

Does that help?

Posted: Wednesday Feb 27th, 2013 at 8:22 am #43302
Thomas
Username: tomrail

Thank you for your reply, Christian!

I was testing as admin, but used:
[s2If current_user_is(s2member_level1) OR current_user_is(s2member_level4)]

That should mean the content is displayed for everyone being level1 OR level4 (where as admin i´m having level4)

I´m using “current user is..” because i do not want to display that content to other levels than specified here.
E.g. payment/upgrade info not needed to be displayed for higher levels..

Anyway, is there anything that could interfere with that shortcodes?
(as said; other shortcodes doing well, getting s2m constants is fine.. just that content protecting does not work)

Posted: Wednesday Feb 27th, 2013 at 9:00 am #43313

That should mean the content is displayed for everyone being level1 OR level4 (where as admin i´m having level4)

No, you’re not s2member_level4, you’re administrator. You have access to level 4 content, but your WP role (current_user_is) is administrator: [hilite code]current_user_is(administrator)[/hilite].

Posted: Wednesday Feb 27th, 2013 at 9:52 am #43323
Thomas
Username: tomrail

Damn!! Stupid me!! :)

Thank you very much, Cristián!

Of course it is all working now. Fiddled with that issue for countless hours.
I did not thought of an s2m malfunction.. but at same time couldn´t see myself doing anything wrong.

Again, thank you!

Posted: Wednesday Feb 27th, 2013 at 6:12 pm #43350

Glad I could help. :)

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