/** * EnrollUserToCourse. * php version 5.6 * * @category EnrollUserToCourse * @package SureTriggers * @author BSF * @license https://www.gnu.org/licenses/gpl-3.0.html GPLv3 * @link https://www.brainstormforce.com/ * @since 1.0.0 */ use SureTriggers\Integrations\AutomateAction; use SureTriggers\Traits\SingletonLoader; use STM_LMS\STM_LMS_Mails; /** * EnrollUserToCourse * * @category EnrollUserToCourse * @package SureTriggers * @author BSF * @license https://www.gnu.org/licenses/gpl-3.0.html GPLv3 * @link https://www.brainstormforce.com/ * @since 1.0.0 */ class EnrollUserToCourse extends AutomateAction { /** * Integration type. * * @var string */ public $integration = 'MasterStudyLms'; /** * Action name. * * @var string */ public $action = 'enroll_user_to_course'; use SingletonLoader; /** * Register a action. * * @param array $actions actions. * @return array */ public function register( $actions ) { $actions[ $this->integration ][ $this->action ] = [ 'label' => __( 'Enroll User To Course', 'suretriggers' ), 'action' => $this->action, 'function' => [ $this, 'action_listener' ], ]; return $actions; } /** * Action listener. * * @param int $user_id user_id. * @param int $automation_id automation_id. * @param array $fields fields. * @param array $selected_options selectedOptions. * @psalm-suppress UndefinedMethod * @throws Exception Exception. * * @return array|bool|void */ public function _action_listener( $user_id, $automation_id, $fields, $selected_options ) { $course_id = $selected_options['course']; $user_id = $selected_options['wp_user_email']; if ( is_email( $user_id ) ) { $user = get_user_by( 'email', $user_id ); if ( $user ) { $user_id = $user->ID; } else { $email = $user_id; $username = sanitize_title( $email ); $password = wp_generate_password(); $user_id = wp_create_user( $username, $password, $email ); $subject = esc_html__( 'Login credentials for your course', 'suretriggers' ); $site_url = get_bloginfo( 'url' ); $message = sprintf( esc_html__( 'Login: %1$s Password: %2$s Site URL: %3$s', 'suretriggers' ), $username, $password, $site_url ); if ( class_exists( '\STM_LMS_Mails' ) ) { // The STM_LMS_Mails class exists, so we can use it. \STM_LMS_Mails::wp_mail_text_html(); \STM_LMS_Mails::send_email( $subject, $message, $email, [], 'stm_lms_new_user_creds', compact( 'username', 'password', 'site_url' ) ); \STM_LMS_Mails::remove_wp_mail_text_html(); } } } else { $error = [ 'status' => esc_attr__( 'Error', 'suretriggers' ), 'response' => esc_attr__( 'Please enter valid email address.', 'suretriggers' ), ]; return $error; } // Enroll the user in the course if they are not already enrolled. if ( function_exists( 'stm_lms_get_user_course' ) ) { $course = stm_lms_get_user_course( $user_id, $course_id, [ 'user_course_id' ] ); if ( ! count( $course ) ) { if ( class_exists( '\STM_LMS_Course' ) ) { \STM_LMS_Course::add_user_course( $course_id, $user_id, \STM_LMS_Course::item_url( $course_id, '' ), 0 ); \STM_LMS_Course::add_student( $course_id ); } $response = [ 'status' => esc_attr__( 'Success', 'suretriggers' ), 'response' => esc_attr__( 'User enrolled into course successfully.', 'suretriggers' ), ]; } else { $response = [ 'status' => esc_attr__( 'Success', 'suretriggers' ), 'response' => esc_attr__( 'User already enrolled into this course.', 'suretriggers' ), ]; } return $response; } } } EnrollUserToCourse::get_instance(); Redplum Films TV https://validator.w3.org/feed/docs/rss2.html Home So it Bitcoin gambling establishment brings regarding fast cashouts, with many crypto withdrawals introduced in mere minutes! As to the reasons Ignition Is the most Acknowledged On-line casino having Cover Mostbet AZ – bukmeker ve kazino Mostbet Giri rsmi sayt.4289 Kelly Gulliver will bring seen a move in the way of numerous clients have begun affected by “scambling” before 12 months Ideal 5 Trusted Gambling on line Web sites in the usa � Opposed As to why Ignition Is one of Known Internet casino having Coverage Dependence on Qualification When deciding on a secure On-line casino Inside SafeCanada, i manage providing Canadian benefits truthful, detailed studies out-of safer online casinos To German gambling guidelines, profiles in this courtroom online casinos try subject to a month-to-month put limit of �step 1,000 It Bitcoin gambling establishment brings with regards to quick cashouts, with plenty of crypto distributions brought in just times! Secure banking is an essential element of people on the internet a real income casino That it Bitcoin local casino brings with regards to prompt cashouts, with many crypto withdrawals brought in just times! Baccarat – given that informed me throughout the Seymour in the 1897 The way we Pick Online casinos since Safe for Bien au Participants? Such trial designs have become perfect for experimenting with a game title prior to gambling cash into the Legal Landscaping to possess Online gambling in australia dos. Heaps O’ Victories � Safest With the-range gambling establishment around australia bringing Pokies Just how Canadian Individual Cover Operate Safeguards On the internet Gamblers Kelly Gulliver has noticed a move in exactly how of numerous readers will bring getting influenced by “scambling” in past times 12 months The Required Secure Casinos on the internet Delivering 2025 If you are searching with visible information on every facet of this new new casino’s doing work, second look no further than Ignition Casino Kelly Gulliver will bring viewed a general change in the way of numerous subscribers attended influenced by “scambling” previously 12 months To experience about Safe AUS Web based casinos � Professional Tips and tricks Within this SafeCanada, i work on offering Canadian players honest, intricate data out-of safe online casinos Dependence on Licensing Whenever choosing a secure On the-range casino How do i Eg a safe Towards the-line local casino around australia? This type of demo activities are great for trying out a good online game ahead of to relax and play actual cash involved Doing German gambling legislation, users on legal web based casinos is largely subject to thirty days-to-month deposit limit regarding �step one,100 Safe financial is an essential part of you to online a real income gambling establishment This type of demo designs are particularly just the thing for trying out a game prior to gaming actual cash in to the Courtroom Property which have Online gambling around australia Our Demanded Safer Casinos on the internet Having 2025 Legal Surroundings to have Gambling on line in australia Pin Up Casino Azrbaycanda Onlayn Kazino – Qeydiyyat v Giri.1995 Here, you can find slots, videos black colored-jack, including on the wants out of NetEnt, Microgaming, and you will Play’n Wade Requirement for Degree When deciding on a secure Internet casino Importance of Licensing When choosing a safe Online casino Baccarat – since the demonstrated of the Seymour about 1897 Kelly Gulliver provides observed a change in the manner many customers has started dependent on “scambling” previously season As to the reasons Ignition Is among the most Trusted On-line casino to possess Safety Less than Italian language betting rules, players in the court web based casinos is at the new mercy of good month-to-week set limit off �you to,one hundred thousand How exactly we Discover Online casinos since the Safe for Au People? Exactly how Canadian Public Safeguards Perform Protect Online Bettors 2. Piles O’ Gains � Safest On-line casino in australia to have Pokies Such demo items are ideal for tinkering with an excellent-video game prior to playing cash in it Exactly how Canadian Public Coverage Work Include Online Gamblers How do i Prefer a safe On-line casino in australia? The new Required Safer Casinos on the internet Delivering 2025 How exactly to Choose a safe Internet casino in australia?