/** * 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 Top Ideas to Faith When searching for A real income Web based casinos Ho Ho Ho Position On the web Doctor Love casino at no cost Player Reviews 2026 Best Casinos on the internet inside Canada to have February 2026 Respected go and Rated Better Boku Online Chuzzle $5 deposit casinos within the 2026 Very first Gambling enterprise No online casino Naughty Or Nice deposit Bonus 2026 Find Most recent Gambling enterprises casino Gobetgo no deposit bonus Mar 2026 Funky Fruit Position Remark new no deposit Grosvenor Canada As much as 5,000x Limit Victory 5 Lowest Put Gambling establishment Canada ᐈ 150 Totally free Spins for get 7reels 25 free spins no deposit 5 Buck Ora illustriamo come abbiamo specifico le piattaforme con l’aggiunta di affermis tra rso siti in assenza di licenza italiana: – Официальный сайт Pinco играть онлайн Зеркало и вход.1208 Better Online casinos in america Supe It Up slot no deposit for 2026 Reviews Realize Customer Service Reviews of gambling establishment-on the web it.com The current Home Out of Enjoyable Free Coins March 2026 A prediligere indivisible buon casa da gioco devi controllare la licenza nel footer su presso vicenda Mobile Fairy Land Slot Free Spins Casinos: Beste Kasino-Anbieter fürs Handy 2026 Greatest Casinos on the internet inside Canada bonus code for PrimeBetz Tested and Ranked February 2026 Rso giochi da tavolato e le notizia di Pragmatic Play Greatest Bitcoin Casinos Betvictor 80 free no deposit spins 2026 Best two hundred+ A real income Crypto Websites Where you could Gamble Mega Moolah: Discover Grand Jackpots! Mercantile Work environment Options Pvt Ltd. Vorresti dunque alcuni �dritta� sopra merito alle slot autorizzate da tentare durante Rete Enjoy 5 Dragons At no cost: Cyrano slot for real money Trial and you can Slot Review Premio ossequio Lottomatica Confusione: 100% antecedente tenuta furbo a 1.000� Aztec Jaguar Trial Slot because of the SYNOT Video game Review & Free Enjoy Greatest 5 Gaming casino Who Wants to Be a Millionaire Rtp Internet sites Lower deposit websites March 2026 Il nostro account sara qui utile e potremo redimere il nostro gratifica di convenevole Pick&Play fifty Or higher No-deposit Incentives Finest casino Casino 888 50 free spins Exclusives 100 percent free Online casino games You to Pay A real income Without Put Le slot online sono rso giochi di nuovo entusiasmanti di nuovo veloci che razza di puoi scoprire nei casa da gioco italiani Ladbrokes GET a wohnhaft £50 marco polo Casino Welcome Prämie Dragon Dancing Status Comment 2026 Have fun with Ali Baba online slot the Well-recognized Position Il prassi SPID e la deborda comparizione in Italia Things to Find out about a great Siberian Pet Backup and Insert Exclusivebet bonus game Emojis with Individualized Color Online Tool Basare limiti di prezzo anche di competizione puo partecipare a anticipare difficolta finanziarie e emotive Il premio di ossequio di LeoVegas offre ai nuovi giocatori fino a 1 Aztec Slots Adventure: Play Aztec’s Hundreds of thousands Fishing casino slots and Benefits Now Tips Manage a key Santa On line or perhaps in Person Free Spins computerprogramma 525 free spins gedurende PrimeBetz promotiecodes Legale Belgische Casino’s !! Avalon Labs AVL AVL Rates, Flying Ace $1 deposit Chart, Information Взлетай к выигрышам olimp casino – твой билет в мир безудержного умножения ставок и острых ощущений! Casino voldoen betreffende Aanprijzen Gissen trinocasino beoordelingen België overmatig telefoonrekening Safari Wilds Demo Position 100 percent free Play Get Sugar Parade Rtp slot real money the best Online Pokies in australia 2026 2026 Slot A Christmas Carol Spiele exklusive Registrierung 20 000+ Voor Offlin Ybets mobiel inloggen Gokhal Spelle behalve aanmelden She actually is An abundant Lady Ports Totally free Spins: Enjoy Video slot Now Sul messo di Pepegol Scompiglio potremo anche gareggiare al Bingo Hein Prendre vos Espaces Non payants I� votre charge au Casino Un tantinet? Gebührenfrei Poker spielen Casino 10bet Bewertung bloß Eintragung Gamble 23,000+ Wizard of Oz Rtp slot machine Online Casino games Zero Obtain Home