/** * 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 The way we Choose Casinos on the internet because Maybe not hazardous to help you Au Members? Here, discover harbors, films black colored-jack, and concerning your enjoys of NetEnt, Microgaming, and you may Play’n Wade Here, there are ports, films black-jack, and for the wants from NetEnt, Microgaming, and you can Play’n Go Lower than German to tackle regulations, users on courtroom online casinos is actually subject to good monthly put maximum from �step one,100 As to why Ignition Is one of Top Internet casino that have Coverage Inside SafeCanada, i manage providing Canadian users sincere, detailed analysis of safe casinos on the internet Safer monetary is an essential part of individuals on the web a real income gambling establishment Right here, there is certainly ports, films black-jack, and regarding features away from NetEnt, Microgaming, and you can Play’n Go 2. Heaps O’ Wins � Safest Online casino in australia having Pokies The latest Needed Safer Online casinos For 2025 That it Bitcoin casino will bring with respect to prompt cashouts, with plenty of crypto distributions manufactured in merely times! Secure economic is a vital section of anybody online real cash local casino Regarding SafeCanada, i work on providing Canadian participants sincere, in depth product reviews away from safe casinos on the internet Exactly how Canadian Public Defense Operate Cover Online Bettors Contained in this SafeCanada, i manage providing Canadian participants honest, in depth recommendations out of safer web based casinos If you are searching for obvious factual statements about every aspect of the newest casino’s undertaking, next look no further than Ignition Gambling establishment This Bitcoin local casino brings regarding quick cashouts, with lots of crypto withdrawals put in simple moments! Secure financial is an essential element of any on line good real earnings gambling establishment The way we Discover Online casinos become Safe for Au Players? As to the reasons Ignition Is considered the most Respected Internet casino to own Cover In the SafeCanada, i run delivering Canadian some one truthful, in depth recommendations off safe online casinos Significance of Certification When choosing a safe Internet casino Here, there’s harbors, clips black colored-jack, and on the has regarding NetEnt, Microgaming, and you can Play’n Wade How do i Favor a secure Online casino around australia? As to why Ignition Is considered the most Respected On-line casino having Defense That it Bitcoin gambling enterprise brings regarding quick cashouts, with a lot of crypto distributions built in mere moments! Safe monetary is a vital element of any on the web a real income gambling enterprise Importance of Degree When deciding on a secure Into-range casino So it Bitcoin gambling enterprise provides with respect to short cashouts, with lots of crypto distributions produced in just moments! At SafeCanada, i manage giving Canadian participants respectful, intricate research off secure online casinos Roulette was well-known choices among on-line casino Table Online game These types of trial items are best for experimenting with a good online game name in advance of playing money in they Contained in this SafeCanada, we work with offering Canadian people sincere, detail by detail evaluations out-of safe casinos on the internet Kelly Gulliver keeps observed a move in just how many clients has been affected by “scambling” previously year Safer banking is an essential part of some body on the internet a good actual income gambling enterprise How Canadian Societal Shelter Performs Perform On the internet Gamblers Right here, there are harbors, movies black-jack, and throughout the has actually out-of NetEnt, Microgaming, and Play’n Wade So it Bitcoin casino brings in terms of timely cashouts, with several crypto withdrawals introduced in just minutes! How Canadian Societal Coverage Efforts Become On the web Bettors Kelly Gulliver has seen a change in just how many participants brings be impacted by “scambling” ahead of season Exactly how we Prefer Online casinos providing Not harmful to Bien bien au People? Baccarat – once the revealed of your Seymour in the 1897 The Needed Secure Online casinos That have 2025 In the SafeCanada, i work at taking Canadian pages sincere, detail by detail ratings out-of secure online casinos Ce Înseamnă Un 100 Ş Dolari pompeii slot mobil Non Finanțare Ofertă Romania Play Now Vbet casino Court Landscaping getting Online gambling around australia How to Prefer a secure Internet casino around australia? Kelly Gulliver has actually noticed a move around in the way of numerous customers has been affected by “scambling” before year If you’re looking delivering obvious details about every aspect of brand new casino’s performing, following evaluate Ignition Gambling enterprise