/** * 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 Free Revolves без депозит 2026 Styled мобилно приложение trinocasino Range Games Machines, Играйте безплатно Wizard from Ounce: Way to the brand new Emerald Town 100 percent free Trial 2026 Free Casino games One Shell out A real income Without Put Finest Web based casinos Us 2026 Best-Ranked & Trusted A real income Internet sites Fortunate Larrys Lobstermania 2 تم التحقق من أنها ألعاب تجريبية مجانية بنسبة 100 بالمائة على الويب Nuts Orient Position Opinion & The best places to Gamble On line Microgaming Top ten Internet casino Real cash Sites February 2026 Visa Online casinos One to Service Visa since the Detachment Strategy Gambling Calculators #1 RTP Checker to possess Slots & Gambling enterprises Real-Date Dual Twist Slot Opinion 2026 Gamble 100 percent free Trial Gamble 19,300+ 100 percent free Slot Video game Zero Install Multiple Diamond Slot Free Play On-line casino Ports Zero Down load Casino slot games Wikipedia Gamble Alaskan Angling Harbors 2026 Remark To have Australians Top Bitcoin Gambling enterprises: Better BTC Crypto Betting Internet sites to possess 2025 Biggest Guide Spending reports 400% Local casino Incentives to possess U S. People eight hundred% Gambling enterprise Incentives Top ten Finest Online casinos right now 2026 Tomb Raider Position by Microgaming » Laura Croft is here Hollywood Collectibles Tunica, Mississippi Yahtzee 31 totally free spins no deposit necessary Wikipedia Sense Quality Slots Having Thor 55 The newest No-deposit Bonus Rules To have Mar 2026 Updated Daily 300% Extra First Put Gambling establishment Offers : Maneki Pro Selections Greatest Free Spins No deposit Now offers 2026 step one,000+ Spins! AC_DC Thunderstruck Certified Movies Nuts Panda Position Free Enjoy and Comment 94 36 % RTP Casino slot games Remark Top 10 Internet casino A real income Web sites February 2026 Finest $5 Minimal Put Casinos Us 2026 Finest Online video Ports 2026 Totally free Spins & Award Multipliers Troll Seekers 2 Position Comment 2025 Play for Free Right here Thunderstruck II position Totally free Gamble On the web Microgaming Home Debunking Myths About Transfer on Death Deeds and Estate Planning Legal Tools for Smooth Property Transfers After Death The Path to Ensure a Smooth Transfer of Boat Ownership: A Step-by-Step Guide What Makes Articles of Incorporation Key to Your Business Structure Cut Stack 150: Un Alleato Potente per il Tuo Allenamento Guide complet du casino en ligne : tout ce que vous devez savoir en 2026 Guide complet du casino en ligne : tout ce que vous devez savoir en 2026 Chicken Road – Tragamonedas de casino en lnea que convierte los cruces de gallinas en ganancias.730 Chicken Road – Tragamonedas de casino en lnea que combina humor y grandes premios de gallinas.635 Официальный сайт Pinco Casino играть онлайн – Вход Зеркало.12423 – Официальный сайт Pinco Casino.12085 Chicken Road – Tragamonedas de casino en lnea con aventuras interminables de gallinas cruzando la ca.237 – Официальный сайт Pinco играть онлайн Зеркало и вход.5942 (2) Casino Bet jak gra w kasynie online krok po kroku.4974