LLMS_AJAX_Handler::update_student_enrollment( array $request )
Add or remove a student from a course or membership.
Parameters Parameters
- $request
-
(array) (Required) $_POST data.
Return Return
((WP_Error|array))
Source Source
File: includes/class.llms.ajax.handler.php
// Setup an object for the optgroup if it's not already set up.
if ( ! isset( $items[ $post->post_type ] ) ) {
$obj = get_post_type_object( $post->post_type );
$items[ $post->post_type ] = array(
'label' => $obj->labels->name,
'items' => array(),
);
}
$items[ $post->post_type ]['items'][] = $item;
} else {
$items[] = $item;
}
}
echo json_encode(
array(
'items' => $items,
'more' => count( $items ) === $limit,
'success' => true,
)
);
wp_die();
}
/**
* Add or remove a student from a course or membership.
*
* @since 3.0.0
* @since 3.33.0 Handle the delete enrollment request and make sure the $request['post_id'] is not empty.
* Also always return either a WP_Error on failure or a "success" array on action performed.
* @since 3.37.14 Use strict comparison.
*
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.37.14 | Use strict comparison. |
| 3.33.0 | Handle the delete enrollment request and make sure the $request['post_id'] is not empty. Also always return either a WP_Error on failure or a "success" array on action performed. |
| 3.0.0 | Introduced. |