/** * 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 Test post title Short the avengers slot machine Hit Slot machines 2025 Lucky Harbors Applications on the internet 40 free spins 2025 no deposit Gamble Free Good fresh fruit Machine Games: List of Finest Fruits Slots playing best slots real money for fun Sheep Moved Nuts Slot Comment 2025 100 percent free Play mr cashman slot machine Trial BitStarz local casino liberty slots casino Added bonus Codes Crypto Bonuses, No deposit Added bonus & Ongoing Rewards 50 Free Revolves No-deposit Gambling enterprises Get United 7 monkeys slot for real money kingdom 2025 Casino Freispiele bloß gladiator of rome Slot -Bonus Einzahlung Neue Kasino Free Spins 30 Freispiele abzüglich Einzahlung Tagesordnungspunkt Casinos Bonanza Slot Online Casino 2025 Deposit ten Rating 100 Free free slots uk 300 shields Spins Finest ten Gambling establishment Incentives United kingdom Buffalo King Für mighty kraken Slot Free Spins nüsse vortragen bloß Eintragung as part golden egypt Online -Slot of Online Casinos via Echtgeld vortragen Vision Out of Horus 7 Totally free Revolves No-deposit Multiple Twice Da Vinci double-bubble free 80 revolves Expensive diamonds Slot Remark & Totally free Delight in Extra چیدانه پلاس 50 Freispiele bloß Einzahlung sofort ramses ii Online -Slot verfügbar inoffizieller mitarbeiter 2025 Athena’s Magnificence The new Golden Time Demonstration Gamble Position slot game rockabilly wolves Games a hundred% Free Twice Diamond Slot machine: Free Position Online online pokies real money game On the internet No Install Greatest online play 50 lions slot online no download slots for real currency having unbelievable picture 2025 Free Spins hvis ikke indbetaling 2025 Få øje på ma bedste i24Slot casino login tilbud her! Discuss Best Egyptian-Themed Harbors that casino Spin City casino have Super Incentives The brand new Year’s Day Gambling enterprise Bonuses 2025 Happier New-year! Chicago Gold Position: Enjoy 100 percent free Trial Slot by dead or alive mobile slot the Microgaming #step one Free online Social Gambling establishment Feel Empower Your Passion Build a Thriving Community & Monetize Your Content with OnlyFans Strategies. Fortune Looking: Gold-rush Game from mega moolah slot free spins the DiceLab Gamble On line Pinnacle for Android Free Application Install Echtgeld Slots Diese besten Spielautomaten inside 2024 online Şansă pentru distracție Top 21+ cele apăsător bune jocuri de chef prep următoarea raclă comportament! JackpotCity Cassino é confiável? Apreciação Cassino JackpotCity Bônus Cassino Pix, Código promocional 20 Giros dado Melhores cassinos online com giros grátis 2025 Rodadas acostumado 10 Melhores Jogue Highway Kings Pro Algum Real Açâo Sem Armazém Forex 10 plus grands situation de blackjack en Bonus de machines à sous vulkan spiele ligne du appoint profond 2025 Columbus appareil a dessous jeter un oeil sur le site offert pour Greentube avec 9 bandes de credits RTP en compagnie de N Avait Columbus accessoire vers dessous offert de Greentube en compagnie de 9 lignes de credits RTP Dépôt de casino pay by phone de N Joue Casino Gratification Sans nul Classe 70 Direct Offres désintéressées curieuses & jouer release the kraken recouvrables Allez en Accessoire pour Dessous Gates of Olympus Essayez À 100 Mademoiselle Donné- Le Chance Florale Une ! Vérification avec recevoir pour la maille : merveilleux deux +20 de votre point de vue Možnost, igranje, linije za Uk Unlock 2025: Scottie Scheffler je največji favorit Opena, medtem ko je bil leta 2015 Finest On the web Baccarat Betting in the Malaysia + Real time Baccarat Sites Največji teniški naslovi 2025 Najnovejši profesionalci, odkleni nas, odkleni turnir in PGA bet-at-home részletes ajánlások Minden, amit a bet-at-home-ról tudni kell 888Sport Ontario alkalmazás letöltése 2025: Mobiltelefonon keresztüli sportfogadás Test post title $5 Deposit Gambling establishment NZ: Deposit $5 get a hundred 100 percent free Spins 2025 A legjobb e-sport fogadási kiadvány 2025-re: Hogyan kezdjünk hozzá Arbitrázs és fedezeti fogadási kalkulátor Paddy Energy Android és iOS alkalmazás letöltése és telepítése Paddy Energy mobilalkalmazáshoz Home