apply_filters( 'learndash_process_user_course_access_expire', boolean $expired, int $user_id, int $course_id, int $course_access_upto )
Filters whether the course is expired for a user or not.
Description #
Parameters #
- $expired
-
(boolean) Whether the course is expired or not.
- $user_id
-
(int) User ID.
- $course_id
-
(int) Course ID.
- $course_access_upto
-
(int) Course expiration timestamp.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php
/**
* Example usage for learndash_process_user_course_access_expire filter.
*/
add_filter(
'learndash_process_user_course_access_expire',
function( $expire_access = true, $user_id = 0, $course_id = 0, $course_access_upto = 0 ) {
// Example 1: Check for specific user_id value.
if ( ( ! empty( $user_id ) ) && ( $user_id == 12 ) ) {
$expire_access = false;
}
// Example 2: Check for specific course_id value.
if ( ( ! empty( $course_id ) ) && ( $course_id == 34 ) ) {
$expire_access = false;
}
// Always return $expire_access.
return $expire_access;
},
30,
4
);
Changelog #
| Version | Description |
|---|---|
| 2.6.2 | Introduced. |