Page 1 of 1

"shared" access

PostPosted: January 27th, 2012, 12:02 pm
by yolle555
Hi!

I have a blog with s2member and with ccaps I manage different access rights of my subscribers. I now have a page that I want to be accessed from two different ccaps. If I put these to ccaps on the page, only those with both of them (ccapA AND ccap B) would be allowed to enter. I would like the access to be ccapA OR ccapB and not ccapA AND ccapB. How could this be arranged? I hope my question is understandable.

Thanks for the great plugin!

Re: "shared" access

PostPosted: January 28th, 2012, 4:22 am
by Cristián Lávaque
Thanks for the kudos. :)

Yes, I know what you mean. In that case you'll need to use conditionals to check the ccaps. WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals

Code: Select all
[s2If current_user_can(access_s2member_ccap_ccapA) OR current_user_can(access_s2member_ccap_ccapB)]
    Content.
[/s2If]


I hope this helps.

Re: "shared" access

PostPosted: January 28th, 2012, 8:31 am
by yolle555
Perfect!
Thanks!

Re: "shared" access

PostPosted: January 28th, 2012, 11:20 am
by yolle555
Hi! The API scripting solution works perfect for the page content, but not for the comments. I would also like the comments of the page to have these access restrictions. I've put the API script text into the body of the page - and it only restrits the page content. Can I put it also in the provided space "Required custom capabilities?" on the wordpress dashboard - this would probably also include the rescrictions for the comments. Must I change it anyhow?
Thanks!

Re: "shared" access

PostPosted: February 2nd, 2012, 11:52 pm
by Cristián Lávaque
Right, the body of the page doesn't include the comments section. It is possible to do that too, but not from the edit page, you'll have to customize the comments template and use PHP conditionals there. http://www.s2member.com/advanced-conditionals-video/