S2member as optimizemember replacement

Hi Carole,
I posted a question about placing orders on different modules:

I know you also work with different modules.
How do you do it so that people can for example buy module 10 but then also deny access to module 6?
Thanks, Philippe.

Each module has a ccap like “lab0119” for the lab module for Jan 2019, or “lab0718” for the lab module for July 2018. The ccaps could be named any way makes sense to you, since the customer will never see those tags.

Ok that makes sense so I need to ise “ccaps”. I will look into that.
Is it then still possible to give acces to someone to all labs at once?
Thanks, Ph.

Hi Philippe.

This may help you understand ccaps (custom capabilities) well: https://s2member.com/kb-article/video-custom-capabilities-for-wordpress/

You can give the person as many ccaps at the same time as you want.

:slight_smile:

Thank you for the feedback,
I will look into it!

One more question:
I added some CCAP code in a shortcode but how will the CCAP be added to the users account?
This is the code (it is just a test):

[s2If current_user_can(access_s2member_ccap_temptest)]<a href="https://k9training.be/gobobby-online-training-welcome-page/gobobby-lijst-video-handleidingen/video-handleidingen-e-collars/temp-test/" target="_self"><img src="https://k9training.be/wp-content/uploads/2019/11/Gedrag-thuis-upload-min.png"></a>[/s2If]
[s2If !current_user_can(access_s2member_ccap_temptest)]<a href="https://k9training.be/s2-de-correcte-relatie-betaling/" target="_self"><img src="https://k9training.be/wp-content/uploads/2019/11/Gedrag-thuis-upload-BW-min.png"></a>[/s2If]

So I have the CCAP “temptest” but how can I add the CCAP to the user and where will that be visible?
I mean, shortly said, how do add/set the CCAP to the users account?

Some time ago you helped me with this code:
<?php
$user = wp_get_current_user();
$user->set_role(‘s2member_level1’);
?>

And it is clear that I can set the user in a new level with that but it is not clear how I have to do that with CCAPs

Thanks for helping. Ph.