dozent_instructor_detach_course( null $course = null, null $user = null )
Detach / delete an instructor from the course instructors list.
Description
Example usage:
$is_detached = dozent_instructor_detach_course();
See also
Parameters
- $course
-
(null) (Optional)
Default value: null
- $user
-
(null) (Optional)
Default value: null
Return
(bool|false|int)
Source
File: includes/user-functions.php
function dozent_instructor_detach_course( $course = null, $user = null ) { global $wpdb; $course = get_post( $course ); $user = dozent_get_the_user( $user ); $is_attached = dozent_instructor_is_attached_to_course( $course, $user ); if ( $is_attached ) { /** * Action hook before detach an instructor from a course * * @since DozentLMS 1.0.0 * * @param object $user User Object * @param object $course Course Object */ do_action( 'dozent_instructor_detach_course_before', $user, $course ); $deleted = $wpdb->delete( $wpdb->dozent_instructor_courses, [ 'ID' => $is_attached->ID ] ); /** * Action hook after detach an instructor from a course * * @since DozentLMS 1.0.0 * * @param object $user User Object * @param object $course Course Object */ do_action( 'dozent_instructor_detach_course_after', $user, $course ); return $deleted; } return false; }
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |