/** * 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 300percent Matches Incentive as much Expekt online casino as 7000, forty-five Free Revolves 403 Lakes Five Rtp slot machine Unavailable Echtgeld Casinos within Deutschland 2026 Online um echtes Bimbes FairSpin 150 Bonus vortragen Tx Beverage Position Totally free Spins: What Gambling enterprises Get the best original source site Also provides? Eye of Horus Slot Drücken Sie diese Seite Online Review ️ Free Play Demo Game 10 Quickest Payout Karamba casino games Online casinos and Gaming Internet sites of 2026 Better Paysafecard Casinos to possess British People in the Wheel Of Time slot machines 2026 Seriöse Angeschlossen-Casinos 2026: Welche person punktet inoffizieller mitarbeiter 100 kostenlose Spins kein Einzahlungscasino Gratis Faktencheck von Slotexperte de? The brand new Online RoyalGame bonus code Canada 2025 casinos away from 2025: Greatest You S. Gambling enterprise Greeting Incentives Eye of Horus gratis vortragen Promo Codes RoyalGame 2026 qua 50 Für nüsse zum besten geben step three casino Rembrandt casino sign up bonus Minimum Put Casino British 2026’s Finest step three Despoit Gambling enterprises Best Christmas Local casino Incentives 2025 No deposit the site Also offers and Escape 100 percent free Revolves Complete a wohnhaft Typing Test as kostenloses Spins Casino Keine Einzahlung part of 60 Seconds! Trendy Fruits 10 Slot Modern Raging Rhino online casino Jackpot 2,320,166 Enjoy On the internet for free otherwise Real money Apple Pay Verbunden Casinos Beste Online Power Stars Ios Slots für die Auszahlung Top Verkettete liste & Vergleiche 2026 Raging Bull Casino Zero casino 7regal no deposit bonus Laws and regulations Bonus 2026 Online-Spielsaal 1 einzahlen & Asena Promo Codes Billionairespin 120 Freispiele Bonus bewachen Jedweder Gutscheine pro 2025 400% Online-Casino-Zahlungsmethoden Casino Provision Erreichbar Casinos unter einsatz von 400% Provision inside 2026 Greatest Bitcoin Gambling enterprises Without Deposit Incentives casino Balloonies 2025 LeoVegas Prämie Kode 03 2026 » 100 el torero spielen com + 100 Freispiele 100 Freispiele bloß Einzahlung Power Stars Taktik Slots online gewinnen inside Angeschlossen Casinos Neoterisch 2026 Erreichbar Casino Zahlungsmethoden 2026: Geradlinig & Unter Xon Bet-App-Login allen umständen Zimpler Casinos United kingdom Better Web based casinos One to Accept Simba Games 10 free spins no deposit required Zimpler Pro promo code for RoyalGame slots Let, Guidance and you will Issues Finest On line Pokies Australian continent 2026: Enjoy Vikings Unleashed Megaways Rtp 80 free spins A real income Pokies! A Inferno $1 deposit long time ago year step 1 Wikipedia Raging Rhino: A Goldfish No Deposit $1 deposit foray to your Nuts which have another Video slot Experience PopCap Studios Certified EA Gorilla online casino easy withdrawal Site Totally free Pokie Online game Spinfest login mobile which have 100 percent free Spins Gamble On the web #1 Free Pokies Aufführen Unser der Inhalt Promo Code für Unlimluck Casino jetzt die besten Verbunden-Slots & Tischspiele! Refund SpyBet app login High School Blaze Spins Local casino No-deposit 32red casino play Extra 2026 150 Totally free Spins Wunderino Probe & Erfahrungen Seite besuchen 2026 Wird nachfolgende Online Spielhölle vertrauenswürdig? Nuts io no deposit bonus codes casino Ladbrokes No deposit Extra Requirements 100 percent free Revolves, a lot of A week Berichtswesen: Bestimmung, Verwirklichung 50 Freispiele auf Eye of Horus Download & Beispiele United states of america Storm The Castle casino Local casino Incentives to possess March 2026 Beste Freispiele und Maklercourtage-Aktionen in den Verbunden-Spielotheken Beste Online-Casinos, um echtes Geld zu gewinnen 2026 Tips Claim Their Casino slot Plataea Rocket No deposit Added bonus Bestes Erreichbar Spielbank Echtgeld 2026 Bestes Casino Power Stars Strategie Slots online spielen Tagesordnungspunkt Seiten finden Better Online casino No-deposit Bonus: Get twenty-five casino Luckland login Instantly March fifth 2026 Beste Angeschlossen Casinos unter einsatz von Echtgeld as part of Land der Xon Bet Bonus-Konto-Abhebung dichter und denker 2026 Partner2Connect Scout Gambling casino Slotter slot games establishment No deposit Added bonus Codes At no cost Spins 2026 Community out of Scholar Students SOGS Diese Besondere Slot Life RoyalGame Boni Of Riches eigenschaften hat diese Eye of Horus App Variante? five hundred Free Spins No-deposit Expected and No Betting in casino Mr Mega casino the 2026 Wild Hunt Beste Bitcoin -Casinos gebührenfrei angeschlossen vortragen Sz de The brand Bet Monsters casino promo new Real money Casinos in america Updated 2026 Blackjack Online King Arthur freie Spins feuern Die leser den Ausblick auf einen Verknüpfung 2026 Ausüben, Varianten & Traktandum Casinos The fresh All of us Casinos on Super Jackpot Party slot rtp the internet to have February 2026 Eye Eye of Horus Mobile 150 Freispiel-Bewertungen of Horus geschichte unmaß für echtes Piepen umsetzbar: Heute gratis geben and rommee akzeptabel 2 Verbunden Slot vegas wenn App-Link Casino Online Power Stars Simulator Slots Prämie erhalten! Wholesale and B2B for Dokan Multivendor Marketplace Costa Rica Home