Custom capabilities in page sidebar not working for multiple ccaps

When I type in ccaps into the sidebar for pages, it works if I only enter one ccap. But if I enter comma-delimited multiple ccaps, it no longer works and access is denied.

The API Scripting admin page says " Whenever you edit a Post/Page (i.e., there is a Meta Box for s2Member in your Post/Page editing station) … you can tell s2Member to require certain Custom Capabilities that you type in, using comma-delimited format."

So if I select “Level 1” for Page Level Restriction and then entered “ans” for Require Custom Capabilities, it works… but if I entered “ans,mns” (meaning I want any Level 1 user with either “ans” or “mns” ccap to have access) , then it doesn’t work.

Am I doing something wrong? Or is this a bug?

OK, if I have a user that has exactly the listed ccaps (in this case both “ans” and “mns”), then it works. So it looks like the ccaps that are required for access are ALL listed, NOT ANY listed.

Is this the intended behavior or is this a bug?

If it is intended behavior (which I think would be odd), how do I get ANY listed ccaps to work? (EITHER “ans” OR “mns”)

Looking into the code for restricting access via CCAP, I can confirm that it takes the multiple items together with an AND, rather than with an OR.

Unfortunately, it doesn’t appear as though any allowance is made for OR lists — at least with how I am reading the code for this input field.

I suspect that the only way to get the info you are after is filtering your page content itself. I would try using the following code block (untested), to see if it restricts your content appropriately:

[s2If current_user_can(access_s2member_ccap_ans) OR current_user_can(access_s2member_ccap_mns)]
>>>Your content here<<<
>>>You don’t have access. Please upgrade your account<<<

It would definitely be nice if there was options like what you are wanting. Hopefully this is at least a usable workaround, even if it is less than ideal.

Cam, thank you for looking into it. I appreciate it very much.

Yes, manually typing the code block you suggested works. It’s more work than just entering the ccaps into the sidebar box but at least there is a workaround.

Thanks again.