Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for daylight savings and leap years when scheduling engagements #2800

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: patch
type: fixed
links:
- "#2799"
entry: Fix for daylight savings and leap years when scheduling engagements.
13 changes: 1 addition & 12 deletions includes/class.llms.engagements.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ private function add_actions() {
}

add_action( 'deleted_post', array( $this, 'unschedule_delayed_engagements' ), 20, 2 );

}

/**
Expand Down Expand Up @@ -208,7 +207,6 @@ private function get_engagements( $trigger_type, $related_post_id = '' ) {
* @param int $related_post_id WP_Post ID of the related post.
*/
return apply_filters( 'lifterlms_get_engagements', $results, $trigger_type, $related_post_id );

}

/**
Expand Down Expand Up @@ -249,7 +247,6 @@ protected function get_trigger_hooks() {
* @param string[] $hooks List of hook names.
*/
return apply_filters( 'lifterlms_engagement_actions', $hooks );

}

/**
Expand Down Expand Up @@ -405,7 +402,6 @@ private function parse_hook( $action, $args ) {
$parsed['related_post_id'] = $related_post_id;

return $parsed;

}

/**
Expand Down Expand Up @@ -450,7 +446,6 @@ private function parse_hook_find_trigger_type( $action, $related_post_id ) {
}

return $trigger_type;

}

/**
Expand Down Expand Up @@ -485,7 +480,6 @@ public function maybe_trigger_engagement() {
$this->trigger_engagement( $handler, $engagement->delay );

}

}

/**
Expand Down Expand Up @@ -570,7 +564,6 @@ private function parse_engagement( $engagement, $trigger_data ) {
);

return $parsed;

}

/**
Expand All @@ -594,7 +587,7 @@ private function trigger_engagement( $data, $delay ) {
if ( $delay ) {

as_schedule_single_action(
time() + ( DAY_IN_SECONDS * $delay ),
current_datetime()->modify( "+{$delay} days" )->getTimestamp(),
$data['handler_action'],
array( $data['handler_args'] ),
! empty( $data['handler_args'][3] ) ? $this->get_delayed_group_id( $data['handler_args'][3] ) : null
Expand All @@ -616,7 +609,6 @@ private function trigger_engagement( $data, $delay ) {
remove_filter( 'llms_skip_engagement_processing_checks', '__return_true' );

}

}

/**
Expand All @@ -640,7 +632,6 @@ public function unschedule_delayed_engagements( $post_id, $post = null ) {
if ( 'llms_engagement' === $post_type ) {
as_unschedule_all_actions( '', array(), $this->get_delayed_group_id( $post_id ) );
}

}

/**
Expand All @@ -660,7 +651,5 @@ public function log( $log ) {
if ( $this->debug ) {
llms_log( $log, 'engagements' );
}

}

}
Loading