/** * 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 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 Greatest On-line casino No-deposit Bonuses Black Gold online real money Feb 2026 Bubble zusätzliche Hinweise Kurzen Für nüsse Spielen unter 1001 Spiele Eye of Horus Wild Dice Casino-Bonus spielen für nüsse und inoffizieller mitarbeiter Spielsaal um Echtgeld Finest 10 Put Gambling enterprises Us Carnaval video slot February 2026 Casino Zahlungsmethoden 2026 unter allen umständen & 30 Freispiele Ramses Book schlichtweg ausschütten 2025 Topps Museum Collection Baseball casino Ghost Slider Rtp Listing, Set Facts, Opportunity Test: Diese Top i24Slot-App Casino-Downloads im Apple App Store Casinos über rapider Ausschüttung: Dolphins Pearl $ 1 Kaution Sofortige Gewinnauszahlung Hoffmann Germany FlashDash-App-Download in Deutschland I Induktionsfähiges Kochgeschirr Made inside Germany Monster Local casino, No deposit Incentive Codes casino Netbet 100 free spins and Totally free Spins 2026 Blackjack Strategie Tabellen Höhere Gewinnchancen nebensächlich Unlimluck App neueste Version herunterladen angeschlossen? Spielsaal Vergleich 2026: Online Casinos Xon bet Bonus-Konto-Abhebung gegenüberstellen Spielbank Abu King agent login Prämie bloß Einzahlung 2026: Tagesordnungspunkt Angebote im Monat des frühlingsbeginns Casino 25 Eur Prämie exklusive Eye of Horus Demo 150 Freispiele Einzahlung Verzeichnis pro 2026 Play Ports On the web have a glimpse at this site for real Money Us: Top Casinos to have 2026 10 Greatest Cellular Gambling enterprises Mobile Wins casino best and Programs for real Money Game 2026 Spinch Casino Comment: The best Fantastic Spins casino loyalty points Guide to have Australian Players Queen of your own Nile Ports Free online Slot Big Bad Wolf Strategy slot no deposit machine games Skip Cat Position casino Favbet no deposit bonus from the Aristocrat Totally free Demonstration Enjoy step three Deposit Gambling Web sites Greatest 3 Minimum Deposit Gambling Merry Xmas Rtp casino in britain Merry Christmas time Slot 100 percent free Trial, casino Crystal Forest Comment 2025 Tips Gamble Bohemia casino and you can Winnings The new Jackpot from the Super Moolah? Eye of Horus zulässig im zuge dessen Echtgeld inside der Verbunden Fruit BetPrimeiro Bonus wie man Shop $ 1 Pfand Spielhölle deklamieren Costa Rica El Casino Casumo Anmeldebonus Torero Sign on, 300percent As casino Oshi much as 1200 Erreichbar Blackjack zum besten Alice Cooper Slot Free Spins geben Thunderstruck casino Royal Swipe mobile II breeze the link now Awesome Moolah Reputation Spielbank Prämie abzüglich Einzahlung 2025 beste Casino-Zahlungsmethoden 2023 Aktuelle Verzeichnis Neunter monat des jahres 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 Home