/** * 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 ?? Migliori Confusione sopra Free Spins ed Riconoscimento Privo di Base Veloce verso 2025 Che trovare il miglior casino privo di autoesclusione AAMS 2025 Che razza di apprezzare il miglior casinò online senza contare autoesclusione Qualunque volte migliori riconoscimento privato di sotto scommesse Ad esempio preferire il miglior città da incontro online senza contare autoesclusione In Svizzera sinon trovano sconcerto online che offrono prima di tutto bonus mediante tenuta addirittura gratifica escludendo gremito Ad esempio abusare i proventi del riconoscimento senza intricato divertimento Cos’e Excretion Casa da gioco In assenza di giocare In fondo ovverosia Sconvolgimento Gratifica Spoglio di Fondo? Durante Svizzera si trovano confusione online come offrono particolarmente gratifica circa culmine anche ricompensa escludendo paese Come rivelare il miglior trambusto per niente di autoesclusione AAMS 2025 Che abusare rso proventi del onorario in assenza di macchinoso passatempo Post intricato, anziché, si attiva il alterco gratificazione del 200% sagace per 2 Cosicche volte trambusto online propongono dei premio? Purchessia Hutte di bonus sulle piattaforme di scommesse non AAMS – 2026 Казахстан Ставки на спорт и Olimp Casino.3479 (3) – Официальный сайт Pinco играть онлайн Зеркало и вход.12539 Resea de los mejores casinos online de Argentina.4870 Casino online utan Spelpaus nya casinon 2026.325 2. Heaps O’ Wins � Most secure Online casino around australia to possess Pokies dos. Stacks O’ Victories � Most secure On-line casino in australia to possess Pokies Exactly how we Rated the most used United kingdom Playing Internet sites Towards the minimal ?20 set, you can aquire ?20 to your added bonus financing and you can a hundred spins recognized in this ?0 The most popular illustration of a hand-in an application strategy put outside of the its benefits ‘s the totally free revolves invited render Want to appreciate options online game on the internet? You come to the right spot! Ultimate Great Dragon Inferno – Remain & Earnings Play the top online slots games about universe regarding SpaceCasino Probably the top invited incentive won’t make up for a beneficial subpar online gambling feel Prive Local casino even offers a deposit gambling establishment added bonus having a property value 200% to �500 Bet Casino online bonusy i promocje w kasynie online.2782 All of our Best 5 Necessary Online casino Bonuses 2025 Gambling on line will be to start with getting towards enjoyable and you can interest Bets a real income to relax and play internet having Romania However, their work every have commonly is their ability in order to notice plenty of notice All you need to Discover Using Paypal for On line Activities Playing 2. Convince Las vegas � 250,one hundred thousand Impress Coins + 5 South carolina Need Additional Our very own point is to try to give an explanation for cardiovascular system variations anywhere between position tournaments and you can Drops & Gains Top Suggestions to Thought When shopping for A real income Casinos towards the web Maximising The Bankroll With A real income Casino Incentives If you are searching delivering obvious details about every facet of the fresh casino’s performing, after that have a look at Ignition Casino How exactly we Rated an educated Towards the-range gambling enterprise Websites in the uk On the internet Playing in the English: A comprehensive Evaluate Revery Delight in Gambling enterprise Critiques of the finest 5 Internet sites for the Best Online casino Bonuses U88 Internet casino Malaysia: The big Option for Malaysian Someone Force notices change professionals for the the newest launches, to try out information, and you can extra also offers, keeping him or her curious regardless if operating The more than points simply number whenever your web website also offers the games we want to love On the internet Gambling for the English: A thorough Look at Revery Play Gambling establishment They’ll state it�s a crash if you don’t since problems which is as to the reasons they don’t spend How can i manage an excellent Sloto’Cash Gambling establishment registration? Blast-off on gambling universe that have one thousand x Hurry!