S2member as optimizemember replacement

In the “protected page”, I only use ccaps and conditionals to protect the content and NOT the “extremey easy way”, with the box on the side of the page/post. Instead, I use code like this on the page itself:

[s2If current_user_cannot(access_s2member_ccap_classABC)]
    here is the sale pitch with a buy now button (or form) for this class, because the user does not have the classABC ccap.
[/s2If]
[s2If current_user_can(access_s2member_ccap_classABC)]
    here is the content for that class (video, documents, pdf, etc.) because the member has that specific access to classABC ccap that was purchased
[/s2If]

Using the “Extremely easy way” to protect the page by level or ccap (in that s2M box on the right side) will always redirect to the Membership Option page if the user does not have the proper ccap, and I find it much harder to sell individual classes on that page, especially if you have several classes.

I am not really sure. I don’t think s2M can actually track where a user is in a sequence of content. I don’t think it is meant for that, but maybe someone could have a way to retrieve information if a page was visited or a video played. It is not something I have looked into because all my modules/classes are independant from each other and don’t need to be taken in any particular order.

Hope this helps.

Read here on how to change: Move from s2member to Optimizemember

I moved my smaller website to Optimizemember because it promised ThriveCart support - and back then the s2member pro credit card checkout was horrible. I had little incentive to move back - because last year both plugins were pretty similar. However with Optimizepress no more updating optimizemember and not renewing their s2member licensing - it’s much better to move (back) to s2member.

Thrivecart never fully worked anyhow - and Optimizepress does not seem to have many/any qualified developers - based on that they never really developed anything on Optimizemember (Thrivecart working was more due to people convincing Thrivecart to integrate OPM than the other way round I guess).

Hi Carole,
Where do you put that code?
I made the page in Elementor (not pro edition). You probably must do it in wordpress without elementor or with Gutenberg? Is that correct?
Thanks. Philippe.

In the case of the classes listed in the MyAccount page, the resulting pages are done in WP classic editor, but you could but that text in other Elementor widgets too.

One thing I found is that if you want to protect content on a page built with Elementor, you need to protect each widget individually, which can be annoying, so whenever I can, I use the WP Classic editor for that. That is why, out of the 650+ pages of my site, only about 50 were built with Elementor widgets. The rest are done with WP.

Ok that’s clear.
But where exactly in the elementor block do you put that code?
Because I see Layout, style and advanced but I have not idea where to put the code.
Can you please explain that? Thank you.

It would be in the content, just as if you were to put the code in the standard WP editor.
Here is an example where I am using Elementor widgets (blocks).


Each module is also built similar to the MyAccount page. The code used in one of the “modules” is in a “shortcode widget”:

[s2If current_user_can(access_s2member_ccap_mlab201909) OR current_user_can(access_s2member_ccap_diamond)]<a href="https://scrapbookcampus.com/the-lab/lab-9-module-09/" target="_blank"><img src="https://scrapbookcampus.com/wp-content/uploads/2019/08/Lab-9-09-300.png"></a>[/s2If]
[s2If !current_user_can(access_s2member_ccap_mlab201909) AND !current_user_can(access_s2member_ccap_diamond)]<a href="https://scrapbookcampus.com/the-lab/lab-9-module-09/" target="_blank"><img src="https://scrapbookcampus.com/wp-content/uploads/2019/08/Lab-9-09-300-BN.png"></a>[/s2If]

Sometimes, shortcodes can work fine in a Text widget, sometimes, in HTML widget, sometimes in Shortcode widgets, sometimes in Custom HTML widget. I am not 100% sure why some widgets will work or others won’t but it is easy to check.

OK i am not sure why it does not display as the code here, but hopefully, you can get a good idea.

You need to wrap it in tripe-backticks ( ` ). I fixed it for you. :slight_smile:

Thank you for your help!
I am new in this and it is not so easy so I appreciate it a lot!
Now I understand the thing with the widget shortcode and I made this code:

Access for level 2
[s2If current_user_can(access_s2member_level2)] <a href="https://k9training.be/gobobby-online-training-welcome-page/" target="_blank"><img src="https://k9training.be/wp-content/uploads/2019/11/Video-handleidingen-min.png"></a>[/s2If]

But in the example of Carole, when the user has access, it is in color and when the use doesn’t has access, it is in grey.
How can I also do that please?

And what is the thing about the ccap? What is that?

thank you. Philippe.

ok, I found out how to make it colored and when black/white.

But now when you click on it, the page refreshes itself.
How can I make it go for a user with access continue to the page where he has access too?

And how can I make it so that for a user without access that it goes to the membership page?

thanks.

It would just be a matter of linking the image to the different pages.
The images (black and white or color) are simply different images I created separately.

Thanks for answering Carole.
How/where do you link the different pages in the shortcode?
Now I have the shortcode and the images are visible so all that is fine but how do I link the destination page in the shortcode?

In your shortcode, I cannot see it.
Thank you. Ph.

<a href="https://scrapbookcampus.com/the-lab/lab-9-module-09/" target="_blank"><img src="https://scrapbookcampus.com/wp-content/uploads/2019/08/Lab-9-09-300.png"></a>

The href= indicates the URL, and the img= is the image that the URL is associated to.
So my image is
<img src="https://scrapbookcampus.com/wp-content/uploads/2019/08/Lab-9-09-300.png">

and the link is
<a href="https://scrapbookcampus.com/the-lab/lab-9-module-09/" target="_blank">

All that is wrapped in the conditional shortcode.

Thanks Carole, now it is clear and this works!
Without your help I would not have made this so fast.
I still have a lot to learn but now I can start with building up!

Glad I could help.
I find that s2M is so powerful that it can look intimidating for a newcomer. So many settings. So many options. But once you understand the principle of the protected content, the rest is yours to do whatever you want with it. I have been using it for over 8 years now and I learned a lot, even though I am not a programmer at all. (I am even allergic to html and css!)

If you have any other question, don’t hesitate to ask.

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.