apply_filters( 'learndash_approve_assignment', boolean $approve, int $user_id, int $lesson_id, int $assignment_post_id )
Filters whether an assignment should be approved or not.
Description #
Parameters #
- $approve
-
(boolean) Whether assignment should be approved or not.
- $user_id
-
(int) User ID.
- $lesson_id
-
(int) Lesson ID.
- $assignment_post_id
-
(int) Assignment ID.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php
/**
* Example usage for learndash_approve_assignment filter.
*/
add_filter(
'learndash_approve_assignment',
function( $approve, $user_id, $lesson_id, $assignment_post_id ) {
// May add any custom logic using $approve, $user_id, $lesson_id, $assignment_post_id.
// Always return $approve.
return $approve;
},
10,
4
);
Changelog #
| Version | Description |
|---|---|
| 2.5.5 | Added $assignment_post_id parameter. |
| 2.1.0 | Introduced. |