Status:
Answered
Release Task:
During my testing of trial memberships, I had one membership set to expire after one hour. The trial membership would expire and the user would be charged immediately, even if cron ran within an hour. I found that in the database, ms_recurring_schedules.next_payment was being set to a date in the past. Looking in the code, it seems that ms_core_get_string_time is missing a case in the switch statement for hours. I added it so that the function now looks like this:
- function ms_core_get_string_time($trial_length, $trial_unit) {
- switch ($trial_unit) {
- case 'D':
- $unit = ($trial_length > 1) ? 'days' : 'day';
- break;
- case 'W':
- $unit = ($trial_length > 1) ? 'weeks' : 'week';
- break;
- case 'M':
- $unit = ($trial_length > 1) ? 'months' : 'month';
- break;
- case 'Y':
- $unit = ($trial_length > 1) ? 'years' : 'year';
- break;
- case 'H':
- $unit = ($trial_length > 1) ? 'hours' : 'hour';
- break;
- default:
- $unit = $trial_unit;
- break;
- }
- return "+$trial_length $unit";
- }
The next_payment is then set correctly, and the customer is charged when expected.








Thanks for letting me know. The hours unit is new and that function wasn't updated like it should have been. It will be in the next release.
-Leighton