Roles and Capabilities for s2Member

Looking at the help page created for Role and Capabilities…

I’m wondering if there a set that just defined its usage for just one level, such as is_s2member_level2, meaning that ONLY those in level 2 can see this content?

I don’t want people above level 2 to see.

I need this because of Uber Menu has a conditional option for its menu items, and it allows capabilities to determine if a menu item can be seen or hidden. s2member_level0-4 options work, but it compiles access. I just want to specifically define access like can be done with parts of the s2member API.

Can you restate you problem. It is not clear. Are you trying to get Uber menu to show / hide automatically based on a users s2member level?

Yes, and Uber Member works with the access_s2member_level0-4 capability. However, that allows for progressive access, so those with level 3 access can also see levels 0-2. I’d like to have an option that just allows for level 2.

Is there a capability that does just that?

I know there are shortcakes and PHP code created for that. I use the PHP versions for custom and inline content.

S2member levels are actually WordPress roles. Uber menu, like most menu systems, can be configured to display contextually based on role. The Uber Menu Conditionals (https://sevenspark.com/goods/ubermenu-conditionals-extension) allows two conditions so User is [s2-member-access2] AND User is not [s2-member-access3]. Won’t work if you have more levels though.

You are asking for advice but only providing part of the context. For example, you do not say how many levels your design requires, you do not state what information you are trying to protect, how much of the protection is manual and how much you require to be automated and through s2member ecommerce purchases.

The bottom line is s2member does not offer auto-protection out-of the box for user-specific protection only content-specific protection and role-based protection if tied to ecommerce.

So if you make the content you want to be hidden in the menu for everyone but s2member level2 then create a custom post type and only use the custom post type for level2 content.

I just want a menu item to only be shown to the people with level 2 access. I didn’t know if I was missing a capability that said is-level-2 vs. access-level-2. access-level-2 means level 3 can see it. access-level-2 means level 1 can see it.

I do have multiple conditions set up in the Uber Menu conditional section, but I considered that a workaround. Right now I just have 4 four levels.

You want something to work that is not going to work. I’ve explained why.

If you want a suggestion on how to achieve your goal you will need to describe the scenario…what are you protecting, from whom, when, how many people.

I gave you one suggestion for a viable solution but you chose not to comment on it. It would do the job.

You asked for context. I provided the situation. I was curious why it wouldn’t be an option when there are shortcodes and PHP scripts provided that do that exact same thing.

current_user_is(“s2member_level2”) - that in a pre-defined capability is what I was wondering existed. Just a thought going forward if it’s really not. I use these inline in multiple sections of my website, and it’s a great feature. As a capability it would really work well with other plugins.

It’s an entire section of the API Scripting:

<?php if (current_user_is("s2member_level4")){ ?>
Some premium content for Level 4 Members.
<?php } else if (current_user_is("s2member_level3")){ ?>
Some premium content for Level 3 Members.
<?php } else if (current_user_is("s2member_level2")){ ?>
Some premium content for Level 2 Members.
<?php } else if (current_user_is("s2member_level1")){ ?>
Some premium content for Level 1 Members.
<?php } else if (current_user_is("s2member_level0")){ ?>
Some content for Free Subscribers.
<?php } else { ?>
Some public content.
<?php } ?>

You’ve have to pardon my curiosity on why it’s not pre-defined WP capability too. My first thought, it probably was and I likely just can’t find it or figure it out.

Keep in mind that I am just another s2member user like you…

I agree with your assessment…it’s curious that such an API-rich product has such a console-lean support of that extended functionality.

Who knows what went on in the minds of the original authors but it is fair to say that everyone has known that this is a coder-slanted plugin.

You seem like a coder…why not just code a ubermenu filter based on the current_user_is() s2member function?

I’m not a great coder, more of a tweaker. I’m hoping they see this and add in the ‘is’ capability, because they have PHP and shortcode versions in their API that differentiate ‘can’ and ‘is’.

It would add one more layer of functionality, especially with other plugins who allow you to use WP capabilities to stretch their usage.