Hi, Iamdez.
I can replicate the bug. Let me take a look and see what’s going on. Are you finding the Scheduled Dates/Times coming up relatively quickly on the back end?
Thread Starter
Iamdez
(@iamdez)
Yeah, they take about 5 seconds to show all of the dates set out from now until expiration. If I’m reading you correctly you’re talking about the button on the rule setup page that shows me the list of dates/times that the rule is in effect for.
Yep, that’s what I was referring to.
I think I found the problem: the array of days of the week was being set up differently depending on whether you were checking the scheduled dates on the back-end or loading them from the rule settings. If you’re comfortable with copying/pasting code, you can try replacing the __getNextWeek
function with the following code:
function __getNextWeek( $current, $interval_multiplier, $days = array() ) {
if ( empty( $days ) ) return strtotime( $interval_multiplier . " week", $current );
$currentDayOfWeekIndex = date( "w", $current );
sort( array_values( array_unique( array_merge( array( $currentDayOfWeekIndex ), $days ) ) ) );
$daysOfWeek = array_combine( $days, $days );
if ( $currentDayOfWeekIndex == max( $daysOfWeek ) )
$pattern = ( ( 7 - $currentDayOfWeekIndex ) + ( 7 * ( $interval_multiplier - 1 ) ) + ( min( array_keys( $daysOfWeek ) ) ) ) . " day";
else {
$nextDayOfWeekIndex = $currentDayOfWeekIndex;
do {} while ( !isset( $daysOfWeek[++$nextDayOfWeekIndex] ) );
$pattern = ( $nextDayOfWeekIndex - $currentDayOfWeekIndex ) . " day";
}
return strtotime( $pattern, $current );
}
Let me know if this works for you; it seems to fix the issue here. If it doesn’t blow up horribly, I’ll be pushing out an update in the next day or 2.
-K
Thread Starter
Iamdez
(@iamdez)
I replaced the function wholly and it seems to be working.
I did get the following when I activated the plugin, though
[Sun Dec 01 14:46:01 2013] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in /wp-content/plugins/timed-content/timed-content.php on line 656, referer: http://mysite.org/wp-admin/plugins.php
Thread Starter
Iamdez
(@iamdez)
Marking this as resolved.
Glad that worked for you, and thanks for the heads-up on the activation warning. I’ll see what’s going on there.
-K