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_Student_Bulk_Enroll::enroll( WP_User $user, string $trigger )

Enrolls a user into the selected product


Parameters Parameters

$user

(WP_User) (Required) User object

$trigger

(string) (Required) Enrollment trigger string


Top ↑

Source Source

File: includes/admin/class.llms.student.bulk.enroll.php

	private function enroll( $user, $trigger ) {

		// Enroll into LifterLMS product.
		$enrolled = llms_enroll_student( $user->ID, $this->product_id, $trigger );

		// Figure out notice type based on enrollment success.
		$type = ( ! $enrolled ) ? 'error' : 'success';

		// Figure out notice message string based on notice type.
		$success_fail_string = ( ! $enrolled ) ? __( 'Failed to enroll <em>%1$1s</em> into <em>%2$2s</em>.', 'lifterlms' ) : __( 'Successfully enrolled <em>%1$1s</em> into <em>%2$2s</em>.', 'lifterlms' );

		// Get formatted message with username and product title.
		$message = sprintf( $success_fail_string, $user->display_name, $this->product_title );

		// Generate a notice for display.
		$this->generate_notice( $type, $message );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.20.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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