LLMS_Student_Bulk_Enroll::maybe_enroll_users_in_product()
Conditionally enrolls multiple users into a product
Return Return
(void)
Source Source
File: includes/admin/class.llms.student.bulk.enroll.php
public function maybe_enroll_users_in_product() { // Verify bulk enrollment request. $do_bulk_enroll = $this->_bottom_else_top( 'llms_bulk_enroll' ); // Bail if this is not a bulk enrollment request. if ( empty( $do_bulk_enroll ) ) { return; } // Get the product (course/membership) to enroll users in. $this->product_id = $this->_bottom_else_top( 'llms_bulk_enroll_product', FILTER_VALIDATE_INT ); if ( empty( $this->product_id ) ) { $message = __( 'Please select a Course or Membership to enroll users into!', 'lifterlms' ); $this->generate_notice( 'error', $message ); return; } // Get the product title for notices. $this->product_title = get_the_title( $this->product_id ); // Get all the user ids to enroll. $this->user_ids = filter_input( INPUT_GET, 'users', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); if ( empty( $this->user_ids ) ) { $message = sprintf( __( 'Please select users to enroll into <em>%s</em>.', 'lifterlms' ), $this->product_title ); $this->generate_notice( 'error', $message ); return; } $this->enroll_users_in_product(); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.20.0 | Introduced. |