I am trying to add custom capabilities using a select box when the user registers for my site. My users are from different locations. Each location has its own download files. I am trying to add their location as a ccap so I can limit the files they can download based off of their location. I have s2member pro so I will be using Stripe for the most part. How would I add the ccap when the form is submitted? I know that PayPal has the following method: ws_plugin__s2member_pro_paypal_registration_post_attr, but I dont see anything for Stripe. Thanks guys!
Add Custom Capabilities with Form Input
I suppose you create this select box with a custom form template? Maybe you can create it with “bundling” of several payment options, it’s possible with Pro version. Then in “options” you set the need ccap, thus users will set the ccap directly while they register. And not need any additional code. Not sure if this is possible with Stripe, but get it a try…
Thanks for the reply Krum. Yes, I created a custom form field in S2member that shows up during the registration process. Are you suggesting creating an form option for every location? I also have 9 payment options. Would this still work if, per se, I had 20 ccaps?
Oh, you already have payment options… OK, as “location” is a custom field, any hook that runs at registration time, and after creating the new user, can be used. Like, you can even use “wp_footer” hook, to filter only “new registration” requests, and to do your job in DB (to copy the custom field as a new ccap).
Thanks again Krum. So there is a way for me to copy the custom field into the ccap field? If so I would really appreciate if you could point me in the right direction. Thanks again for your help!
I am looking for something similar; I want to put the custom Registration/Profile field data into ccaps when they’re created or edited.
I’ll look at what you mentioned above to trigger the ccap data updates.
It would be really nice if you could set up ccaps as part of the custom field definition
Thanks for the idea. I added it to the feature requests list.
You can write a bit of code that does this for you now, though… In the Login Welcome Page, you could check that custom profile field and give the user the ccaps if he doesn’t have them yet. https://s2member.com/kb-article/rolescapabilities-via-php/
How many locations?