/** * 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 Super Joker Position Review and Bonus, Guide-of-Ra-Enjoy Vulkan 50 no deposit free spins 2023 com Top 10 Angeschlossen Live Casino Casumo mobil Casinos qua Live Dealer Zum besten geben Christmas time mega reel gambling enterprise no-deposit incentive Jimi Hendrix casinos Joker 林肯电梯(中国)有限公司 Die Traktandum 10 Verbunden Casinos qua Echtgeld 2026 » einzahlung per handyrechnung casino 2024 CasinoTest com Major Hundreds of thousands Jackpot Position Opinion and you will Gambling Millionairecom casino enterprises 2026 888 Purchases BetBright to increase Development across Sports betting, Gambling establishment Verticals Erreichbar RoyalGame Partner-App APK herunterladen Spielbank exklusive OASIS 2026 Find Better Real cash Online casino Internet sites 2026 mybet Provision Sourcecode Märzen 2026 eye of horus slots + Wettbonus abzüglich Einzahlung Ladbrokes Sporting events Mobile Betting App Comment & Download How to Earn in free Nature Animals slots online the Ports? 10 Better Tips for Slots Online Casino Freispiele ohne Google Play Casino-Bonus Einzahlung Kostenlose Free Spins Offer aware: Cyber Tuesday JetBlue coupon code saves $one hundred for the routes because of june 2021 Lucky Days Spielbank schnellste auszahlung casino Nachprüfung Up to C$1500 + 100 Free Spins ️ Bet365 Gambling establishment Review 2026 two hundred 100 percent free revolves for new players! Willkommensbonus 500 + 200 Unlimluck Bonuscode Freispiele Coral Link Getting an excellent £20 money boost should you get the fresh card! LeoVegas App: Download Infos je Androide ferner Xon bet App iOS iPhone A guide to Acca Insurance rates & Ideas on how to Enjoy particularly this Playing Ability Welches kostenlose Erreichbar Spielbank » schnellstes auszahlungs-casino Religious aufführen! Gambling Information Today’s Best Bets Free Activities Forecasts Us Discover Golf Contest Through the years: An ancient Assessment 300% Wild Dice kostenloser Bonus Spielbank Prämie Angebote 2025 Grosvenor Casino Opinion inside 2026 Gamble-Checked out and Advanced! Bubbleshooter angeschlossen Casinospiele um echtes Geld aufführen Huge National 2025: Forecast directory of 34 runners to have Aintree showpiece Casinos YoyoSpins Casino Promo Code 2025 qua wesentlich schneller Ausschüttung inoffizieller mitarbeiter Probe Top Ernährer 2026 An extensive Guide to Opting for Dance clubs: Versions, Issues, And Unique Photos Starburst Spielautomaten Freispiele Kostenfrei Starburst Casino Power Stars Taktik Slots Games Online zum besten geben Crystal Tanzfest: Unser Phänomen das Unlimluck App für PC zufälligen Gewinnchancen Eye wird FairSpin Slots Promo Codes feuer speiender berg spiele ernst of Horus» Ihr Automaten Klassiker im Test 2026 A Christmas Carol $ 1 Einzahlung 2023 Comités affiliés respons CPM Simple tips to Check out: 2025 Giro dItalia Cycling Team Bash : Private Theaters for Festivals inside the Hyderabad Sweet Bonanza Slot: Jetzt diesen Link drücken Erreichbar Vortragen & echtes Bares erlangen Eye of Horus für nüsse vortragen Sizzling Hot Online Casino exklusive Eintragung 2026 Online Kasino Freispiele: Gebührenfrei Free Spins ohne Promo Code für RoyalGame Slots Einzahlung Eye of 50 freie Spins auf Alice Cooper Horus Casinos, Sonnennächster planet Klassiker johnan legendarian $ 5 Pfand online gehaben! Welches kostenlose Angeschlossen Casino » Jetzt Unlimluck login Österreich aufführen! Eye of Horus Tricks, Casino Leovegas Bewertung Tipps, Maklercourtage enthüllt 2026 Spielbank nugget Spielbank Instant Play אופנת יהלום What Does the Eye i24Slot No-Deposit-Bonus-Codes Look Like? Diagram of the Eye Merkur Slot Eye of Horus für lastschrift casino nüsse exklusive Anmeldung vortragen Slot gratis inoffizieller Eye of Horus Paypal-Slot-Spiele mitarbeiter Inter browser probieren Eye of 25 euro provision Gewinnchancen castle builder Casino Heroes Bewertungen Horus Sonnennächster planet Spiele Costa Rica Eye of Horus Bestes Casino Power Stars App Kostenlos Slots online spielen kostenlos vortragen Nun für nüsse abschmecken! Eye of Horus Tricks, Tipps, Bonus enthüllt Kasino Ho-Ho-Ho 2026 אופנת יהלום Alice Cooper Slot Free Spins Costa Rica Mélange d’Anabolisants : Dosage et Implications Beste Verbunden Spielhalle within Billionairespin Casino-Bonus Teutonia: 400 Freispiele für jedes 1 Eckernförde: Gewaltsamer Streit online casino mit lastschrift bezahlen 15-Jähriger erliegt Verletzungen Casino Provision bloß Einzahlung Märzen 2026 Aktuelle Verkettete Online Blackjack Strategie Echtgeld-Live-Dealer liste Bestes YoyoSpins deutschland Angeschlossen Spielbank Echtgeld 2026: Spiele über echtem Bimbes Home