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.

Limited Access Based on Date and Time

Home Forums Community Forum Limited Access Based on Date and Time

This topic contains 7 replies, has 2 voices. Last updated by  cassel 4 years, 1 month ago.

Topic Author Topic
Posted: Friday Nov 16th, 2012 at 1:28 pm #31788

Hey guys, so was wondering, is it possible to trigger s2member to allow access to piece of content for a specific time and day for certain amount of time? For example, we are using event espresso to sell access to online live classes and or events. Upon a user completing the checkout process through our event system, I’d like to tap into s2member API and give access to a link that would launch a video player for the live class. s2member would have to allow access to this link at a specific date and time for each user. Can this be achieved with s2member?

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Friday Nov 16th, 2012 at 1:43 pm #31789
cassel
Username: cassel

Is the date based on calendare dates or based on how long since they sign up? If it is based on how long since they sign up, then it looks like the dripping content feature. If it is based on calendar date, then you can use a conditional with the time feature. I had something similar but using the time of day (in addition to the date). You can read it here:
http://www.s2member.com/forums/topic/can-you-time-the-display-based-on-clock-time/

I dont have the full code accessible right now, but i can post it in a few hours.

Posted: Friday Nov 16th, 2012 at 2:03 pm #31793

It would be based on calendar date. Would love to see the code. Also, would this entail configuring s2 for each possible time that link is available?

Posted: Friday Nov 16th, 2012 at 2:22 pm #31799
cassel
Username: cassel

Also, would this entail configuring s2 for each possible time that link is available?

I would imagine so as the content will be inside the specific code.

Here is part of the code i used:

<?php if (date("Ymd") == 20121103){ ?>
         This is content that appeared only on Nov 3rd, 2012
    <?php if (date('H') == 0){ ?>
        code for the embedded video for 12 minight
    <?php } else if (date('H') == 1){ ?>
        code for the embedded video for 1 am
    <?php } else if (date('H') == 2){ ?>
        code for the embedded video for 2 am
    <?php } else if (date('H') == 3){ ?>
        code for the embedded video for 3 am
    <?php } ?>
<?php } ?>  

I had something like that for each hour over 2 days, and i had a video embedded for each hour. Then, when it turned to Nov 5th, i had a simple message saying “Oops, you missed it”. I am not very advanced in coding and php, so someone else might use this as a start and give you more specific information, or you can use this if it is enough for you need.

Posted: Friday Nov 16th, 2012 at 3:08 pm #31810

hmm.. well i’m not sure if this would work, although it does shed some insight.. we would need to allow “content” being displayed every day every time depending if a user had met the payment conditions. meaning, i just bought a live class for tomorrow at 12pm. i will would need to be able to tell s2 let this user access this link on this date and time for 1 hour .. we would have a calendar of classess every day, so it wouldn’t make sense for us to input all that conditional data per the example above. i wonder if there’s a way to do this.. it seems to be instead of using that time of conditional, there might be a way to use s2 api to restrict access via adding conditionals on the user account when they’ve made payment through our ticketing software where by adding the conditionals on the fly per user account. I wonder if any of the s2member support team might be bale to chime in.. @Jason ?

Posted: Friday Nov 16th, 2012 at 3:33 pm #31814
cassel
Username: cassel

You can probably add a condition around that “time code”.
For example, you can sell access to an event that you would call “Event1” (and you associate a Custom capability (ccaps) called “Event1”). Then, you can wrap the code similar to what i used, inside a conditional so the code might look like this:

<?php if(current_user_can("access_s2member_ccap_Event1")){ ?>
<?php if (date("Ymd") == 20121130){ ?>
         This is content will appear on NOv 30th, 2012
    <?php if (date('H') => 12) && (date('H') < 16){ ?>
         placing the event here, it will be accessible starting at 12 noon, until 4pm
    <?php } ?>
<?php } ?>
<?php } ?>

Then, i think it is a matter of playing with those variables. This means that s2Member will check if the member has the ccap called “Event1” and if so, on the set date and time, the event will be accessible. Outside those conditions, the member wont get anything.

Does that make sense?

Posted: Wednesday Nov 21st, 2012 at 8:00 pm #32290

That makes sense, however, what I’m trying to achieve is a bit more complex. Basically, I need to expose a link based on the time and date that has someone has paid for .. My event system would have to notify s2member that user “X” has purchased this access on Month “Y” on Day “Z” at time “B” and the access is available for certain interval. The access will happen anytime of the day some time after they purchased the actual access. IE: I paid today and I don’t access until 2 weeks from now and that access expires after a certain time interval that is set .. Make sense? I could wrap what you have above, but that would mean I would need conditionals for every single time and day forever.. That’s not practical. I’m wondering how this can happen on the fly ..

Posted: Wednesday Nov 21st, 2012 at 8:57 pm #32298
cassel
Username: cassel

It seems a bit complex, but maybe you can look at the Ccap clock timer hack that does set a code based on the time of transaction. You might want to look at this post:
http://www.s2member.com/forums/topic/ccap-clock-timer-perfect-for-magazines/

Maybe once the “timer” is set, you can use that ccap further down?

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