/** * 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 To tackle at Safe AUS Casinos on the internet � Specialist Tips and tricks Criptovalute nei migliori casa da gioco online non AAMS Courtroom Land getting Gambling on line around australia Certain dato di forte profitto per rso nuovi iscritti sono volte premio di cerimonia Baccarat – as chatted about of your Seymour inside the 1897 Casino Mastercard online | Gli Ultimi Premio dei 10 Migliori Bisca Online Here, get a hold of ports, films black-jack, and regarding enjoys regarding NetEnt, Microgaming, and you can Play’n Go Quali sono i migliori bisca online nuovi contro Italia? Secure monetary is a crucial part men and women on line real cash casino Nuovi confusione online durante bonus privo di fitto ancora altre promozioni Secure financial is an essential part of individuals on line a real income local casino Il gratifica non potra capitare impiegato per ottenere ulteriori promozioni Such demonstration systems are very just the thing for experimenting with a beneficial-video game ahead of playing actual cash inside As to why Ignition Is the most Leading Towards the-line casino providing Safeguards Migliori sacco non AAMS addirittura errore italiani: le differenze Finest 5 Easiest Online gambling Websites in the usa � Opposed Gratifica Scommesse LeoVegas, furbo verso 1250� di vincite potenziate Most readily useful 5 Respected Online gambling Websites in the usa � Compared Judge House to own Online gambling around australia Sono conosciute anche per la denominazione di promozioni rituali Most useful 5 Leading Online gambling Websites in the us � Compared Domande frequenti riguardo a slot addirittura aggiunto giochi da casa da gioco gratis Roulette was well-known solutions among on-line casino Desk Game The mandatory Safe Casinos on the internet Having 2025 Why Ignition Is considered the most Known On-line casino which have Coverage 2. Hemorrhoids O’ Gains � Most secure Online casino around australia to possess Pokies NetBet e una trampolino di scommesse online come offre scommesse sportive, casa da gioco anche giochi digitali Che affidarsi verso Finaria per le guide sul gambling As to the reasons Ignition Is the most Respected Online casino having Safety El enfoque de impresiones acerca de lapso eficaz desplazandolo inclusive nuestro cabello modelo audiovisual las guarda igual que referentes globales If you are searching providing obvious information about every facet of the fresh new casino’s operating, next look no further than Ignition Gambling establishment No requieren soltar las superiores juegos de casino gratuito de gozar de los caballeros Safe economic is an essential component of any on line actual currency casino Vikingo Casino Bono Carente Deposito 50 Giros Sin cargo 2026 कनाडा में सुरक्षित इंटरनेट कैसीनो 2026: सुरक्षित जुआ और बड़े बोनस के लिए सर्वश्रेष्ठ 15 कैसीनो वेबसाइटें Aqui te contamos de todsa formas lo que podrí­a llegar a ser peligroso cual hayaras en el casino Lower than German gaming legislation, individuals from the judge casinos on the internet was susceptible to a month-to-month put limitation regarding �one to,one hundred thousand Ensaio aquele Aparelho Grátis pressuroso Slot Crown of Fire Playbonds Casino de dinheiro Acabamento Pragmático They Bitcoin gambling enterprise provides in terms of prompt cashouts, with many different crypto distributions introduced in only times! Aqui te contamos bicicletas esto hayaras dentro del casino As to the reasons Ignition Is the most Recognized On-line casino that have Protection Impronta para criterios acerca de los bonos sobre casino The fresh new Expected Secure Casinos on the internet To own 2025 Aca te contamos unas lo cual encontraras del casino Our Required Safe Online casinos Delivering 2025 Baccarat – due to the fact displayed from the Seymour from the 1897 Apuestas zapatillas deportivas: colocar sobre golf sobre todo clase de acontecimientos Finest 5 Easiest Gambling on line Sites in the usa � Compared Crash by BC cool buck giros livres de slot Game, Análise aquele Aquele Abiscoitar?