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.

Multiple custom capabilities in one purchase

Home Forums Community Forum Multiple custom capabilities in one purchase

This topic contains 3 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years ago.

Topic Author Topic
Posted: Monday Dec 10th, 2012 at 8:51 pm #34190

Hi,

I’m using a paypal button to add a custom capability to a user’s profile which works great.

However, the pages that I want to give that customer access to needs to include the custom capability code in the meta box on the page. This is fine when there is only one custom capability in that box, if I had another, it doesn’t seem to work. So, if for example the user had purchased the capability ‘music’ and i put just that in the meta box it works and they buy access and it’s all good. But they can’t access ‘games’..

So I have a second button, that gives access to ‘games’ and that’s all good.

But what if I want to give access the person that bought ‘games’ to the ‘music’ page as well?

If I type more than one ccapability into the page meta box it doesn’t seem to work.

So, I’m presuming it’s because I need to give the user both capabilities and that there is only one capability per page?

IF so, how do I use a button to give a user multiple capabilities at the same time?

Do I comma delimit them in the buy button?

Am I right in saying you can only add one custom capability per page?

thanks I really hope that made sense!

Rich

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Tuesday Dec 11th, 2012 at 8:33 am #34242

Hi Rich.

So, I’m presuming it’s because I need to give the user both capabilities and that there is only one capability per page?

s2Member will require all the custom capabilities you enter in the metabox for the page. They aren’t one [hilite mono]OR[/hilite] the other, they are one [hilite mono]AND[/hilite] the other.

If you need to do [hilite mono]OR[/hilite], you’ll have to protect the content with conditionals instead of the metabox. [hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]

how do I use a button to give a user multiple capabilities at the same time?

Do I comma delimit them in the buy button?

Yes: [hilite mono]music,games[/hilite].


I hope that helps! :)

Posted: Tuesday Dec 11th, 2012 at 8:53 am #34250

That’s great, thanks!

I was wondering whether it would be possible to do something similar to the paypal buttons, but without them going through to paypal, for example, to be able to go to a user’s profile page and for an admin to ‘gift’ a user the same custom capability that they got from going through paypal? At the moment, going into the user’s profile and adding the custom capability is fine for me as a ‘relatively’ knowledgeable admin, but for people who are simply administering the site and don’t have the wordpress knowledge it would be great to be able to give them buttons.

I suppose I could use the ccap to only allow admins to see the buttons on a user’s profile page… any ideas?

thanks!

Posted: Wednesday Dec 12th, 2012 at 7:25 am #34337

Yes, you can use a conditional with the ccap to show the buttons or not. [hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]

About adding/removing ccaps without going through PayPal or the profile, you could probably create a custom script to do it. This article may help: Knowledge Base » Changing Roles/Capabilities via PHP

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