/** * 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 BetChain Local casino have a glimpse at the link Review Claim 20 FS No-deposit Added bonus, 200FS 14 Better Totally free Spins Gambling enterprises Without lucky ladys charm deluxe casinos Put Incentive Codes 2026 The brand new tiger temple $1 deposit 2026 Casinos on the internet 2026 Greatest The fresh United states of america Online casinos Fantastic treasures of troy $1 deposit Five Casino deposit £1 get 20 casino Wikipedia Neteller Gambling enterprises 2026 casino 200 deposit bonus Online casinos Recognizing Neteller JamSlots Casino Ruby Fortune casino game fifty Totally free Revolves on the BB Splash Slots Secret Museum On line Position Comment 2026 5 thunderstruck 150 free spins Reels & ten Paylines! Totally free Slots Free Online casino games online 3 reel slots On the internet Happy CLAW Host Gamble On line casino 7red login free of charge! Real money Ports & Alive 400 casino bonus 2026 idebit Gambling games 100 percent free Spins On the Credit Subscription kerching casino Canada Free online Pokies Play 7,400+ Totally free Pokies isoftbet slots online Video game! £step 1 Deposit Casinos 2026: step 1 Pound Minimum no deposit bonus codes casino captain Deposit Gambling establishment Uk Better Android os Harbors for 2026 Use the major Android os wild antics $1 deposit Casinos No Obtain Ports Totally free online casino minimum £3 deposit Instant-Enjoy Slots $2 Low Put Gambling establishment inside 2026 Delight in On the wizard of oz ruby slippers play internet Pokies To own Min 2 Money Set Incentive Codes deposit 5 play with 30 casino March 2026 Personal Sale Free Slots Free Gambling luckydays casino games On the web Enjoy Cat Sparkle position on the internet at no cost tomb raider casino bonus no down load Miracle of your Nile Position Comment Play On the web slot game wai kiki 100percent free Now Online survivor slot for money Slots! Salle de jeu Espaces Non payants sans nul Casino en ligne Argent réel baccarat classe au Canada 25 150 produits JURASSIC Playground casino zet 60 dollar bonus wagering requirements Abrasion Jingle Bells Slot machine game cleopatra ii slot machine Absolve to Enjoy Internet casino Games Jack as well as the Beanstalk huangdi yellow emperor $1 deposit Position Remark Indian Thinking Slot machine game to play 100 the true sheriff slot machine percent free Nachfolgende besten Echtgeld Casinos: Damit echtes Bares ernsthaft zum book of ra 6 Slot Free Spins besten geben 2026 Immortal Like Slot Demonstration play monopoly slot online & Comment Funky Mad Mad Monkey Mega Jackpot Monkey Testbericht Besorgen Diese sich Bonus Melhores Casinos Online Portugal comparao das plataformas mais populares.2730 Melhores Casinos Online Portugal comparao das plataformas mais populares.2398 Angeschlossen Casinos via 5 Einzahlung unter anderem exzellenten Slot caesars empire Boni 2026 Immortal Relationship 2 Position Comment Stormcraft indian dreaming casino Studios Finest viking age slot Pokies Software around australia 2025: Enjoy Totally free and for Real cash Unlock 50 two up casino Totally free Spins: Enhance your Local casino Sense Today! Kasino Prämie abzüglich Einzahlung 2026: john hunter and the mayan gods kostenlose 80 Spins Die besten No Anzahlung Boni Get one hundred,one hundred thousand queen of atlantis slot machine Coins Finest Pokies wish upon a jackpot slot to play Without Put Incentives Aussie Book Driver Point Charts Come across Your Mediocre cleopatra 2 casino Yardages 2025 Kundgebung & Spielautomaten Online -Spielen Echtgeld Holly Jolly Penguins Ports Review Earn casino totem treasure 80 Totally free Revolves Lunar New-year added bonus inside the Ho Chi Minh Town within the 2026: investigate the site Highest amount exceeds step 1 8 billion VND for every people. Happier triple triple chance casino bonus Holidays Slot 2025 Free online Trial Games Freispiele exklusive Einzahlung Casinos Sizzling Hot Deluxe tricks am automaten unter einsatz von Free Spins 2026 Happiest Xmas Forest dogecoin casino Slot Game Remark High Bluish Position Play casino 777 60 dollar bonus wagering requirements for Totally free otherwise A real income, Added bonus Higher Bluish Position Totally free Enjoy Internet gold fish slot casino Slots Zero Down load Casino Portugal Online melhores plataformas para jogar com segurana.2001 (2) Home