Scenario: WordPress installed with s2Member, with two users: admin (and Administrator) and user (a registered "Free" Subscriber).
When user is logged in, I can use the following shortcode to test access level (as expected):
- Code: Select all
[s2If current_user_is(s2member_level0)] ... [/s2If]
The s2Member documentation implies that WordPress Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. I expected that current_user_is(s2member_level4) would return true when admin is logged in. This is not the case. Instead, the correct check is:
- Code: Select all
[s2If current_user_can(access_s2member_level4)] ... [/s2If]
The admin has the capability to access_s2member_level4 but does not actually have the role of s2member_level4.
One point of confusion is that user is a Subscriber (roll), but current_user_is(s2member_level0) still works. I expect this is because s2Member does something to take over the role assignment of Subscriber (and others?), so current_user_is('subscriber') is functionally equivalent to current_user_is(s2member_level0) (in all cases?). What is the most reliable/correct call to make?
Any expert insight into this conclusion is appreciated. Even though this is probably obvious to those more familiar with WordPress Roles/Capabilities, I'd recommend a short blurb somewhere in the docs (unless I missed it). Overall, now that I (think I) understand, I'm really making quick progress developing a paid member site; s2Member is really impressive.