/**
* Example usage for ld_course_access_expires_on filter. - Change course expiration date for a specific user
* Please keep in mind that the user might need to be re enrolled manually in the course.
*/
add_filter(
'ld_course_access_expires_on',
function( $course_access_upto, $course_id, $user_id ) {
//Change $course_id = 240 and $user_id = 4 by the corresponding user id and course id.
if ( ( ! empty( $course_id ) ) && ( $course_id == 240 ) && ( $user_id == 4 ) ) {
//Change expiration date
$course_access_upto = strtotime('2020-11-30');
}
// Always return $course_access_upto.
return $course_access_upto;
},
10,
3
);
Copy to clipboard