/** * 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 Pixel e Sorpassi Sfida la Frenesia di Chicken Road e Guadagna Punti per Ogni Attraversamento a Vuoto Emoción y Estrategia El casino online donde tu fortuna espera cada tirada. Attraversa la strada, schiva le auto Chicken Road gioco, lavventura che metterà alla prova i tuoi ri Eye of Casino royal vegas Bewertung Horus Für nüsse ein Innerster planet Slot angeschlossen Eye diamond dogs Casino of Horus Verbunden via Echtgeld vortragen 2026 The changes after that across the desk is minimal plus in just one to the newest online game entering the top Place and spin due to ?ten providing registered on the Super Award Servers Which encompasses scores of video game show to ensure accuracy Kelly Gulliver brings seen a change in how many website subscribers has already been affected by “scambling” in earlier times seasons Bovada – Ideal for On line Live Agent Roulette Games A fast Book on how to Enjoy On the internet Roulette Continued the latest exploration various models off roulette, it’s time to render Eu roulette the due Reviews regarding Greatest 5 Internet toward Top Online casino Bonuses Guaranteeing Safety and security: How Brief-Commission Casinos on the internet Manage Players’ Resource An informed Casinos on the internet one Take on Paypal Commission Form Begin their journey which have a casino Incentive! BoVegas No-deposit Spin Palace casino welcome bonus Added bonus Requirements $150 Free, 20 Free Spins Mar 2026 Online casinos provide a handy and you may safer experience because the a new player can play from his own domestic Why Ignition Is among the most Trusted Internet casino to own Security Specialist Tips for Obtaining Very On Local casino Extra step 1. High quality and value from Invited Even offers Innovative Vorstellbar Casinos Über Startguthaben Ohne Einzahlung – Up to 400 Vermittlungsgebuhr Spins upon A wohnhaft great initially Vorarbeit The guidelines of Playing within Canada’s Toward-line gambling enterprise Internet sites Recommendations off Finest 5 Web sites with the Finest On-line casino Bonuses How exactly we Rated an educated Online casino Internet sites in britain Push announcements revise users on the the latest launches, betting facts, and extra also provides, left her or him interested whether or not travelling Subscription Procedure for the genuine Currency Local casino Internet Cellular deposits allows you to make use of mobile to help you devote and you can repay it yourself second mobile mobile phone expenses Sportpesa Super Jackpot Welcome � 17 Yes Online game Now for Huge Gains Come across your chosen casino bring and simply click the web link on the gambling enterprise web site to sign-up and you may you may claim their extra King of your own Nile Totally free Slot machine game On play nachrichten slot online no download the internet Play Online game, Greentube Put and you will twist due to ?10 become inserted on Mega Honor Machine On the European-Framework Roulette you might set a form of alternatives called the initial four Just how to Spot the Top Gambling enterprise Incentives & Sign-Upwards Offers? Below German playing guidelines, users at court online casinos was at the newest compassion out of 1 month-to-few days deposit restriction away from �one to,one hundred thousand The fresh more than factors simply count when your web site even offers this new current online game we want to play Initiate its excursion that have a casino Even more! Manage Gambling establishment 100 % 100 percent free Spins Has actually A catch? Rizk is an expert internet casino on Canada that is section of new all over the world acknowledged Betsson Category Deposit and you will twist as a consequence of ?10 was joined towards Mega Prize Machine Ideas on how to Put throughout the a low-Uk Casino Webpages? Usually do not Lose out on This type of Amazing Revenue from the Finest On-line casino Web sites Top Ideas to Think When shopping for Real cash Websites based casinos King Of the Nile Pokies Remark 2026, Queen Of the trolls pokie Nile 100 percent free Users possess day to simply accept the advantage shortly after it is provided Revealing Exciting Discounts for United kingdom People within Reveryplay Online casino An informed online casino Zimpler on the Switzerland 2024 Ma Bedste Tilslutte Spillemaskiner Pr. effekt af Spilleban tres amigos Rigtige Knap for Danmark 2024 All you need to Know Playing with Paypal to possess On line Sports Betting