Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Tweaks › eMember – Can Subscription Duration be set by hour and minute, not just date?
- This topic has 4 replies, 2 voices, and was last updated 12 years, 4 months ago by leo_osborne.
-
AuthorPosts
-
July 24, 2012 at 4:15 am #6974leo_osborneMember
Hi. I need to be able to set a subscription to end at a specific time of day. The code in the jquery.cookie.js that runs this functionality uses the Date() object and should be able to accept hours, minutes, seconds and milliseconds as input.
In my shaky understanding (I am not a coder, just a dabbler), the code initially looks for a number from the admin panel to set subscription duration. if it finds this number, it calculates when the number was entered and adds the number as days to that date. if it receives input from the calendar widget, it turns that into a string and sets the “expires” var to this date.
Can you suggest a way to modify the input in the wp admin panel so time of day can added? Can a clock widget be used in addition to the calendar? Or can it be set up to accept values separated by dashes (ex. yyyy-mm-dd-hh-mm)?
Also, where does the code that controls the admin panel live? I get the feeling that is where the change will have to be made.
Thanks,
Leo Osborne
the code…..
var expires = ”;
if (options.expires && (typeof options.expires == ‘number’ || options.expires.toUTCString)) {
var date;
if (typeof options.expires == ‘number’) {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = ‘; expires=’ + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
July 24, 2012 at 5:55 am #47703adminKeymasterThe lowest granularity we can go down to is “day” for subscription duration. Anything other than day, month, year is not supported. This field is sometimes tied with a recurring/subscription payment and payment gateways do not allow an hourly/minute granularity.
July 24, 2012 at 2:36 pm #47704leo_osborneMemberThanks for the quick response.
That does make sense, since PayPal and the like use days as their smallest unit of time for subscriptions.
Our situation is a bit different. We are building a site to live stream concerts. Some of the content (opening band) is free, and some of the content (main band) is paid. Since there is only one stream, the free and paid users are separated into different pages with the same embedded player on each.
We want to be able to allow the free users to watch the opening band only, then block access to the page (or to the player) when the main band starts. By setting the membership to expire a few minutes after the main band is scheduled to perform, free users will be allowed to sample the content and decide if they want to purchase a ticket for the main band.
For a free membership, PayPal will not be in the loop. Single ticket memberships (and in the future, subscriptions), will use PayPal, so the day granularity will be respected in those cases.
We want to modify the plug-in. Which file do we need to look at to change the admin panel? What kind of interface can we use that will allow hours and minutes for free memberships and stop at days for paid memberships?
Can you point us in the right direction?
Thanks again,
Leo
Can you point us in the right direction
July 25, 2012 at 4:50 am #47705adminKeymasterHi Leo, I understand what you want to do but we don’t have the architecture in eMember plugin to handle hour/minute expiry granularity. It it not just a matter of changing a file here and there unfortunately. Without the architecture in place it won’t be possible to do this. Please read the 3rd point from our forum rules which will explain more:
https://support.tipsandtricks-hq.com/forums/topic/forum-rules
July 26, 2012 at 12:38 am #47706leo_osborneMemberOkay. Thanks for the explanation. And the great plug-in. I will look elsewhere for this functionality. Cheers. Leo
-
AuthorPosts
- You must be logged in to reply to this topic.