/** * 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 Home Stéroïdes et performance sportive améliorée Säkerställa Casinon inte me Svensk perso kasinokortspel med bästa odds Licens och Spelpaus Uppräkning 2025 Svenska språket casinon Välj evigt casino Reactoonz 120 gratissnurr tillsamman svensk koncessio Jämför $1 insättning Gonzos Quest Dagens Ultimata Casino Tilläg Online Understanding Nandrolone Course and Its Applications in Bodybuilding 888 Athletics: Sports betting Odds Bet on Activities On the web 32Red Sporting events Gaming: An educated inside On the web Sports Playing VIP Experience nei Casinò Moderni: Come Trasformare la Fedeltà in Vantaggi Esclusivi Natale in Sicurezza: Come la Protezione dai Chargeback ha Rivoluzionato le Esperienze nei Casinò Online Bonus Natalizi nei Migliori Siti di Gioco – Un’Analisi Tecnica dei Regali di Slot per le Feste Il Potere della Psicologia del Giocatore nei Live Casino con Jackpot Real‑Time 32Red Casino Comment 2026 five-hundred+ Video game & £$160 Bonus Da tavolo a streaming: come le piattaforme leader stanno ridefinendo il live blackjack con jackpot da record 32Red Gambling enterprise Remark 2026 Sample: Video game, Bonuses, Mobile App There are some large-top quality gambling establishment internet sites to pick from, for every single with different positives and negatives Particular names give no-deposit free revolves although some provide them with aside because the dollars WR 10x 100 % free spin profits number (merely Harbors amount) inside 1 month Wagering standards establish how frequently you must play through the bonus amount before detachment Zodiac Local casino 1 Bonus Review Zodiac Casino 80 Free Revolves Dolphins Pearl Free $1 deposit for С1 Sign up Incentive step one Deposit Casino NZ, deposit 10 get 100 casino Better step one Money Put Gambling enterprises 2026 WATERMELON Drop Gamble On line free of bonus cash Lapalingo casino charge! Long Money Game slot free spins Branch Saloon Fandom Greatest Paysafecard Casinos Guns N Roses slot United kingdom On-line casino Paysafecard Gamble Free Position Games play Microgaming real money Zero Download, Simply Fun! How to Include Money to Big Bad Wolf Demo slot free spins Cash Application Cards in stores: Easy Guide Gladiator Position Comment Among slots online real money the Epic Ports in the united kingdom Immortal Relationship Slot Totally free Play 22bet free spins no deposit Demo by CasinoMentor Online Madison Peacock slot free spins Kitty Sparkle 1 deposit casinos Getting Charge Bedurfen Welche angewandten Bonuscode pro Spielbank Freispiele blo? Einzahlung? Moglich Spielbank frei Vermittlungsgebuhr: Ganz Tagesordnungspunkt Casinos ohne Maklercourtage Be sure to check the �conditions and terms� to be familiar with the full time limit Ermi�glichen sich einen maximalen Erfolg aufgebraucht einen Complimentary Spins? Beste free Spins i Norge 2026 Hent tusenvis fra SpinBetter casino bonus uten innskudd free spins 100 autonom iWinFortune kontakt i Norge flettverk betydningsløs bidrag admiral nelson fire and ice spilleautomat Våre 10 beste gratis online spilleautomater Guide complet du casino en ligne : tout ce que vous devez savoir en 2024 Guide complet du casino en ligne : tout ce que vous devez savoir en 2024 Were there casinos inside the or near Branson? Happy Charms Gambling establishment No deposit Incentive 2026 Play 21,500+ Online Gambling games Zero Install Methandienone Tabletten in Bodybuilding: Alles Wat Je Moet Weten Obtaining twenty three or higher expensive diamonds in the heart normally personally fetch your a four hundred To join up a free account which have Yellow Lion Local casino, just pursue a few easy steps Penny bingo at Rainbow Wealth Local casino even offers a budget-amicable means to fix see bingo Real cash Gambling establishment Winners: Top Selections One to Match your Playstyle The internet black-jack industry houses many different variations of the video game Along with A seat To Good Televised WPT� Title Experiences Resorts World Nyc comes with an enormous local casino and you can an excellent 400-space Hyatt Regency hotel Reviewers overwhelmingly had an effective knowledge of the firm Nottingham’s Alea is one of the 17 gambling enterprises to receive a great four