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.


Top ↑

Return Return

((WP_Error|array))


Top ↑

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.
	 *

Top ↑

Changelog 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.

Top ↑

User Contributed Notes User Contributed Notes

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