LLMS_Meta_Box_Order_Enrollment::output()

Function to field WP::output() method call


Description Description

Passes output instruction to parent.


Top ↑

Return Return

(null)


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/class.llms.meta.box.order.enrollment.php

	public function output() {

		$order = llms_get_post( $this->post );

		if ( llms_parse_bool( $order->get( 'anonymized' ) ) ) {
			_e( 'Cannot manage enrollment status for anonymized orders.', 'lifterlms' );
			return;
		}

		$student_id = $order->get( 'user_id' );
		if ( ! $student_id ) {// No user id, nothing to show.
			return;
		}

		$student = llms_get_student( $student_id );

		// No student, show a message.
		if ( empty( $student ) ) {
			_e( "The student who placed the order doesn't exist anymore.", 'lifterlms' );
			return;
		}

		$current_status = $student->get_enrollment_status( $order->get( 'product_id' ) );

		$select  = '<select name="llms_student_new_enrollment_status">';
		$select .= '<option value="">-- ' . esc_html__( 'Select', 'lifterlms' ) . ' --</option>';

		foreach ( llms_get_enrollment_statuses() as $val => $name ) {
			$select .= '<option value="' . $val . '"' . selected( $val, strtolower( $current_status ), false ) . '>' . $name . '</option>';
		}
		$select .= '</select>';

		echo '<p>';
		printf( _x( 'Status: %s', 'enrollment status', 'lifterlms' ), $select );
		echo '</p>';

		echo '<p>';
		printf( _x( 'Enrolled: %s', 'enrollment trigger', 'lifterlms' ), $student->get_enrollment_date( $order->get( 'product_id' ), 'enrolled', 'm/d/Y h:i:s A' ) );
		echo '</p>';
		echo '<p>';
		printf( _x( 'Updated: %s', 'enrollment trigger', 'lifterlms' ), $student->get_enrollment_date( $order->get( 'product_id' ), 'updated', 'm/d/Y h:i:s A' ) );
		echo '</p>';
		echo '<p>';
		printf( _x( 'Trigger: %s', 'enrollment trigger', 'lifterlms' ), $student->get_enrollment_trigger( $order->get( 'product_id' ) ) );
		echo '</p>';

		echo '<input name="llms_student_old_enrollment_status" type="hidden" value="' . $current_status . '">';

		echo '<input name="llms_update_enrollment_status" type="submit" class="llms-button-secondary small" value="' . __( 'Update Status', 'lifterlms' ) . '"> ';
		if ( $current_status && 'enrolled' !== $current_status ) {
			echo '<input name="llms_delete_enrollment_status" type="submit" class="llms-button-danger small" value="' . __( 'Delete Enrollment', 'lifterlms' ) . '">';
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.33.0 Added 'Delete Enrollment' button.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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