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.

Access for all custom capabilities

Home Forums Community Forum Access for all custom capabilities

This topic contains 1 reply, has 2 voices. Last updated by  Raam Dev 4 years, 4 months ago.

Topic Author Topic
Posted: Wednesday Aug 29th, 2012 at 10:42 am #23416

Just a quick question:

I’m loving custom capabilities. Thing is, I’d like to have lots (possibly hundreds) of custom capabilities. The following shortcode of course says, “if a user can access the MOVIES custom capability”: [_s2If current_user_can(access_s2member_ccap_movies)]

But is it possible to set the shortcode to say “if a user has access to ANY custom capabilities”? That is, if *any* custom capability has been set for a user, specific content will become visible?

Many thanks!

Geoff

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Wednesday Aug 29th, 2012 at 10:01 pm #23506
Raam Dev
Username: Raam
Staff Member

Hi Geoff,

Unfortunately isn’t such a function, however there are two ways you could implement such functionality.

The first, and far more complicated method, would be to maintain an array of all the custom capabilities you create and then loop through each custom capability check if the user has access to it. If they have access to any of them, then the conditional passes.

The problem with that method is that you’d need to manually update that array in your code every time you use a new Custom Capability.

The easier method would be to simply assign *everyone* a custom capability. You could create a dummy custom capability that gets used for no other purpose other than to check if they have a custom capability.

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