Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Meta_Box_Order_Enrollment::save_delete_enrollment( int $post_id )

Delete enrollment data based on posted values.

Parameters Parameters


(int) (Required) WP_Post ID of the order.

Top ↑

Return Return


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/

	private function save_delete_enrollment( $post_id ) {

		$order = llms_get_post( $post_id );

		 * Completely remove any enrollment records related to the given product & order.
		 * Also note that, by design, at this stage the student has already been unenrolled,
		 * as the delete button is only available when the enrollment status is NOT 'enrolled'.
		if ( llms_delete_student_enrollment( $order->get( 'user_id' ), $order->get( 'product_id' ), 'order_' . $order->get( 'id' ) ) ) {

			$order->add_note( __( 'Student enrollment records have been deleted.', 'lifterlms' ), true );



Top ↑

Changelog Changelog

Version Description
4.2.0 Removed order cancellation instruction, moved elsewhere as reaction to the enrollment deletion. @see LLMS_Controller_Orders->on_deleted_enrollment() in includescontrollersclass.llms.controller.orders.php. Also, add order note about the enrollment deletion only if it actually occurred.
3.33.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.