Thanks for the heads up on this thread.
#1
On my install S2Member appears to behave differently when I restrict access to a page by setting a specific level from the post editing screen (through the metabox) or through s2member>restrictions options>page access restrictions.
When I set the restrictions via the s2member settings screen things work as intended, but if I set the restrictions via the meta box, the conditional is_permitted_by_s2member( $post_id ) doesn’t return false when it is supposed to. This is remedied when I manually plug in the id through s2member>restrictions options>page access restrictions.
Is that intended behavior? I would expect any adjustments made to page access from the post/page editing screen to show up at s2member>restrictions options>page access restrictions.
No, that would indicate to me there is either some confusion about how the API function works, or that there is a deeper issue somewhere in your installation somehow. Restrictions set in the Post/Page editing station (with respect to Level-based Restrictions), are simply updating the options that you see under this section of your Dashboard. Nothing more.
Dashboard -› s2Member® -› Restriction Options -› Post (or Page) Access Restrictions
Is this continues to be a problem, please submit a list of specific instructions on how we can reproduce this in a default WP installation, and we’ll take a closer look for you. I’m not currently aware of any issues in this regard. I was unable to reproduce it with the details we have so far.
#2
When restricting a page based on a specific custom capability, will is_permitted_by_s2member( $post_id ) check for that? Unless something on my setup is interfering, it doesn’t seem to. If this is intended, is there another alternative conditional that will take post_id as a parameter and check for the current user’s access privileges?
Yes, if you’ve used the Post/Page editing station to add a list of one or more Custom Capabilities required to gain access to certain Posts or Pages, the is_permitted_by_s2member() function will consider those Custom Capabilities as well, before it returns TRUE or FALSE. So for instance, if a Post requires Level #2 access, and it also requires Custom Capability music, the is_permitted_by_s2member()
function will return FALSE for someone at Level #2, who does NOT also have the Custom Capability music.
Here are some things I would take a look at:
Have you configured s2Member with a Membership Options Page yet? If not, this is the problem.
See: Dashboard -› s2Member® -› General Options -› Membership Options Page
Are you logged in as an Administrator when testing? If so, this is the problem. Administrators have full access to everything, regardless of your configuration of Level Restrictions or Custom Capabilities. You’ll want to log out of your Administrator account and into an account that will reflect the proper permission level.
Are you passing an ID into this API function?
<?php
if(is_permitted_by_s2member(123))
echo 'Yes';
else echo 'Nope!';
?>
Reference article in Codex: http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_is_permitted_by_s2member()
Please let us know if problem persist. Thanks!