PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

"shared" access

s2Member Plugin. A Membership plugin for WordPress®.

"shared" access

Postby yolle555 » January 27th, 2012, 12:02 pm

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!
User avatar
yolle555
Registered User
Registered User
 
Posts: 13
Joined: January 19, 2011

Re: "shared" access

Postby Cristián Lávaque » January 28th, 2012, 4:22 am

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.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: "shared" access

Postby yolle555 » January 28th, 2012, 8:31 am

Perfect!
Thanks!
User avatar
yolle555
Registered User
Registered User
 
Posts: 13
Joined: January 19, 2011

Re: "shared" access

Postby yolle555 » January 28th, 2012, 11:20 am

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!
User avatar
yolle555
Registered User
Registered User
 
Posts: 13
Joined: January 19, 2011

Re: "shared" access

Postby Cristián Lávaque » February 2nd, 2012, 11:52 pm

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/
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests