/** * 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 Roulette is a prominent selection certainly on-line casino Table Online game How to Like a secure Into-line casino in australia? Greatest Real time Casinos online Wager Actual With Live People Our very own Necessary Secure Online casinos Providing 2025 Eye of Horus für nüsse verhalten and Echtgeld verwenden 太田電子 新しいモノ作りを創造する会社 Right here, discover slots, movies black-jack, as well as on the new wants regarding NetEnt, Microgaming, and you will Play’n Wade Gorgeous Spread out Pokie Wager 100 percent free & Realize Opinion Baccarat – as displayed on the Seymour for the 1897 To relax and play on Safe AUS Web based casinos � Specialist Tricks and tips Таза бағалы металл позициясы Толығымен тегін Gamble and Comment 96 44 goldbet қолданбасын жаңартуды жүктеу % RTP The Requisite Safe Casinos on the internet To own 2025 If you are looking to possess clear details about every factors of one’s latest casino’s working, after that check Ignition Local casino Beste Live Blackjack Online Casinos within Land der dichter und denker 2026 Étudiez la tête buffalo blitz fentes libres de créneaux palpable des jeux de tunes un peu en peu de temps From the SafeCanada, we focus on providing Canadian professionals sincere, outlined analysis regarding secure casinos on the internet How to choose a safe Internet casino in australia? Baccarat – just like the told me from the Seymour into the 1897 Hot shot Casino Slots Obtain & Wager Totally free Right here Better 5 Easiest Gambling on line Sites in america � Opposed Such as for instance demo products are very best for tinkering with a beneficial-game ahead of gaming actual cash to the Eye of Horus Erreichbar Spielsaal Gratis & qua Echtgeld vortragen Ideas on how to Favor a secure On-line casino around australia? Best Live Casinos online 2026 Most readily useful Us Alive Gambling enterprises dos. Hemorrhoids O’ Victories � Safest Internet casino in australia getting Pokies It Bitcoin local casino produces terms of punctual cashouts, with plenty of crypto distributions setup just minutes! Official Site Uk Roulette was popular alternatives certainly online casino Table Games Most useful Live Casinos online Gamble Real time Specialist Video game within the 2026 To play from the Secure AUS Web based casinos � Expert Tips and tricks Gorgeous while the Hades Energy Blend ️ Clover Bingo ️ 96% +ten,000x Online Kasino Provision 2026 Spielsaal Maklercourtage Abmachung Exactly how we See Web based casinos as Safe for Au People? Most readily useful Real cash Ports to experience into the 2026 Discover Most readily useful Slots On line Legal House having Gambling on line in australia Most useful Online slots games the real deal Money Better Game and Usa Casinos If you are searching bringing visible information about every aspect of the brand new casino’s performing, following check Ignition Local casino Top Online slots games for real Currency at On-line casino Sites & Programs Significance of Certification When selecting a safe Into the-line casino Better Online slots games 2026 Most useful A real income Slots Such demonstration goods are most ideal for experimenting with a game title ahead of betting cash in it Real cash Harbors Play Slots in order to Winnings A real income at Most useful Usa Gambling enterprises Exactly how Canadian Personal Safeguards Jobs Safety Online Gamblers gratis vortragen bloß Anmeldung Exactly how Canadian Social Defense Work Become On line Gamblers Top Online casino games On line one Spend Real money with a high Profits How to Bush, Build, and Look after the Holly Tree How to Favor a secure Toward-line local casino in australia? Free Casino games That Pay A real income With no Deposit Siberian Violent storm бейне ойын автоматы: IGT-ден көңіл көтеру goldbet қолданбасы 2026 үшін тегін ойын автоматы бейне ойыны