Reply To: How to use s2IF / else properly and a way to substitute user level in a url

Forums General How to use s2IF / else properly and a way to substitute user level in a url Reply To: How to use s2IF / else properly and a way to substitute user level in a url

#519

however when I display the page for each s2IF test that is false there is a blank line
displaying on the page

Try not having a line-break between the closing and opening s2If tags.

is there a way I can avoid all the /s2IF conditions by replacing the level number

You could do that with s2Get and the level number, if your URLs only change by the level number.

If you have URLs that are more different than just the level number, then you’d need a bit of PHP instead of shortcodes (maybe an array with the level number as the key and the URL as the value).

since I am the admin I will fall into level4

You have Level 4 access, but you don’t have the Level 4 role, you are an Administrator.

current_user_is(access_s2member_level1)

access_s2member_level1 is a capability, which you check with current_user_can. current_user_is checks the role, so it’d be s2member_level1.

current_user_is(s2member_level1)

current_user_can(access_s2member_level1)

See also:
https://codex.wordpress.org/Glossary#Role
https://codex.wordpress.org/Glossary#Capabilities