One Time Offers (Upon-login)

I’ve set up a one time offer, it works a charm, the login offer triggers exactly when it should. Perfect.

However, if a user decides not to take the offer and continue to the site as normal they can still access the page (say they look in their history a week later and click on the offer page)

Is there any way to make it a truly a one-time special offer where S2 blocks it to users unless they are accessing it on the specified login (e.g a custom capability is assigned to the page, and to a users profile for a one time event upon login for the third time only for example)

Thanks

1 Like

Hi Jonathan.

That’s a good point.

Well, you could use the s2Drip shortcode to limit it to the first day, for example. https://s2member.com/kb-article/s2drip-shortcode/

Limiting it to the first view only, though…

Maybe you could give the user a ccap (e.g. “oto”), protect the OTO page with that ccap, and on that page have a bit of PHP that removes the ccap from the user’s account when he lands there. https://s2member.com/kb-article/rolescapabilities-via-php/

So he’ll get to see it because he had the ccap when he got there, but leaves without it so can’t come back.

I hope that helps. :slight_smile:

1 Like

Thanks,

I’m not sure the drip option will work, at least not if my understanding of how it functions as I’ve got the offer set up to redirect on the second login. So it would be unlikely that most people would login twice in one day, especially as people click “remember me”

The php method looks like it would be far better suited.
Although that means I’ve got some learning to do, never a bad thing.

1 Like

Let’s say you call the custom capability “oto” (one-time offer). It’d be something close to this:

<?php
$user = wp_get_current_user();
if($user->has_cap('access_s2member_ccap_oto'))
   $user->remove_cap('access_s2member_ccap_oto');
?>

You’ll need a PHP execution plugin, and put that code in an HTML block if using Gutenberg editor, if I’m not mistaken.

:slight_smile:

1 Like

Thats perfect, thank you!

1 Like