From: Steve Sutton Date: Wed, 8 Jun 2016 14:51:24 +0000 (-0400) Subject: Adding to end date for recurring events X-Git-Tag: v1.0.17^2~6^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=65f50b2d41e38c1525d566b92d64b56db2222374;p=WP-Plugins%2Fglm-member-db-events.git Adding to end date for recurring events If the event has $recurring_event set to true and the from and to dates are the same then adjust the end date to 2 years out. --- diff --git a/models/admin/management/events.php b/models/admin/management/events.php index 1f54ae4..8670b0b 100644 --- a/models/admin/management/events.php +++ b/models/admin/management/events.php @@ -1352,7 +1352,7 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement }else if ( preg_match( ';BYday=(.*);', $rule, $matches ) ) { - echo '
$matches: ' . print_r($matches, true) . '
'; + echo '
1354 $matches: ' . print_r($matches, true) . '
'; // check if the selection is the nth week with a selected day, if not parse the input as a list if selected days if(strpos($matches[1], ",") == false){ @@ -1402,6 +1402,12 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement $serialized_custom_times = serialize($stamp); } } + if ($recurring_event && $from_date == $to_date ) { + // Add two years to the recurring event if dates match + $starting_datetime = new DateTime( $from_date ); + $ending_date = $starting_datetime->modify('2 years'); + $to_date = $ending_date->format( 'Y-m-d' ); + } $all_day = $event_data['allday']; // for the recurrences part $recur_data = array(