/** * 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 Online Casino Guide Cent Ports On the web: ten Finest Game and you will Where you can Enjoy Him or slot Michael Jackson Rtp her Slot tournaments are an easy way to include some extra towards money Välkommen åt vårt svenska Bingo & Casino Online Ino Bingo com As to why Purchase the Cell phone Local casino to tackle Las vegas Harbors? Casino minsta insättning Flamma insättningar på 50 sund Förteckning Slot machines Having Added bonus Online Microgaming games game: Play Totally free Position Online game Bonus Rounds ?? Ein- oder Auszahlungen � begrenzt geregelt je Brd Audits make sure gambling enterprises play with company-owned wallets, not personal ones, to guard professionals Casinostugan utvärderin: Ett djupdykning i digitalt spel med svensk person kvalitet Virtual casino online payment methods Dice and Money Flip Casino inte me konto 2026 Försöka inte me intrikat registrering Over the past couple weeks, I was travel on You, taking-in says such Michigan and you will Rhode Isle Casino utan svensk person koncession: Vägledning till suverän casinon inte med Spelpaus Totally the Slotfather slot free spins free Penny Slots Play Cent Slots Zero Download Hane casino Testa med 100% extra sam free spins! In my situation, it could be in regards to the overall address away from game Colorado’s initial Selection no deposit Cherry online casinos for Fun! Din guide mot att hitta marknadens ultimata casinobonusar The rest show is part of bingo, to play replace and pond gaming Insättningsbonus Insättningsbonusar före Casino & Betting fifty 100 percent free Spins Mobilots casino software No-deposit Greatest 2026 membership offers Ultimata insättningsbonus Samtliga välkomstbonusar Sverige 2026 Casino tillägg utan omsättningskrav omsättningsfria bonusar Queen of one’s Nile free pokie Enjoy position game for fun having FlashDash slots promo code 100 percent free spins Baccarat stadgar 2026 Hur hane lira baccarat för nybörjare As to why Ignition Is among the most Respected On-line casino for Defense Rankings the real deal Currency Betting free spins on Joker Strike Rtp of Funky Fruits Slot judge Onlinespel Försöka dom by�ledning avgiftsfri onlinespelen pc� Zylom To experience at Secure AUS Casinos on the internet � Specialist Tricks and tips Baccarat – because discussed by the Seymour in the 1897 Safer banking is an essential part of that online a beneficial real earnings gambling establishment On much to give, the real real question is, �Why you should appreciate within the Rizk? 2. Hemorrhoids O’ Gains � Most secure Online casino around australia that have Pokies How to Prefer a secure Online casino around australia? How Canadian Societal Protection Operate Were On the internet Bettors Casino tillsamman BankID 2025 Mäta Svenska språke BankID Casinon Baccarat – because the shown on the Seymour for the 1897 If you are searching to possess apparent details about the factors of one’s the newest casino’s performing, then take a look at Ignition Casino However, we accidently stop this variation because of the quicker well-known table style once the French bet names The way we Discover Casinos on the internet is secure for Bien au Professionals? Roulette try a favorite options certainly on-range gambling enterprise Desk Video game Greatest Book of Ra Mystic Fortunes casino free revolves no wagering inside the British gambling enterprises March 2026 Bets real cash gaming websites taking Romania Requirement for Certification When deciding on a secure Internet casino Folgende ein renommiertesten Lizenzen bei der Industrie war bei ihr Malta Gaming Authority (MGA) vergeben To tackle at the Secure AUS Casinos on the internet � Specialist Tricks and tips Safer financial is an essential element of one to on line genuine cash gambling enterprise Kelly Gulliver have seen a change in the way of numerous customers are extremely influenced by “scambling” before seasons Home