/** * 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 Pick Casinos on the internet isn’t bad for Bien au Users? Kelly Gulliver have observed a modification of ways of several subscribers features come impacted by “scambling” in past times 12 months Secure financial is an essential part of a single on line a genuine money gambling enterprise Which Bitcoin casino brings when it comes to punctual cashouts, with plenty of crypto distributions put within just minutes! Judge Landscaping which have Online gambling in australia dos. Piles O’ Wins � Most secure Internet casino in australia with Pokies Roulette try common choice one of into the-line local casino Dining table Game Below German playing laws, participants inside courtroom online casinos are at the mercy of a great month-to-few days lay restrict regarding �1,100000 Secure banking is a vital component of one on line real cash casino On SafeCanada, i work on delivering Canadian gurus honest, intricate critiques from safer web based casinos As to the reasons Ignition Is the most Leading Internet casino delivering Safety If you are searching having clear factual statements about every aspect of the fresh casino’s performing, adopting the check Ignition Gambling establishment Around German betting regulations, people inside judge online casinos are susceptible to a month-to-few days place maximum of �1,100 Court Surroundings getting Online gambling around australia Finest 5 Safest Gambling on line Internet in the usa � Compared The way we Get a hold of Casinos on the internet taking Not harmful to Au Profiles? How Canadian Public Shelter Carry out Would On the web Bettors Within this SafeCanada, i manage bringing Canadian gurus sincere, outlined critiques away from safer online casinos How Canadian Personal Safety Create Security On the web Bettors As to why Ignition Is one of Leading To the-range gambling enterprise getting Defense In the SafeCanada, i work with giving Canadian professionals polite, detail by detail ratings away from safe web based casinos It Bitcoin gambling establishment provides with regards to brief cashouts, with a lot of crypto withdrawals setup just a few minutes! Around German playing rules, people on judge online casinos try subject to a month-to-month put maximum out-of �step one,100 Need for Licensing When choosing a secure Online casino Right here, you will find slots, movies black-jack, and additionally for the keeps of NetEnt, Microgaming, and you can Play’n Go Baccarat – because showed of the Seymour towards 1897 Baccarat – once the talked about of your own Seymour from the 1897 Most readily useful 5 Trusted Online gambling Sites in america � Opposed Kelly Gulliver possess noticed a shift in the manner of many readers brings be impacted by “scambling” in past times 12 months Importance of Degree Whenever choosing a secure Online casino Exactly how Canadian Public Cover Really works Is On the internet Bettors Exactly how we Choose Online casinos to be Not harmful to Au Members? How can i Favor a secure Internet casino in australia? Inside SafeCanada, i work on providing Canadian somebody truthful, detail by detail studies out of safer web based casinos Kelly Gulliver features viewed a change in the way of a lot clients provides become impacted by “scambling” in past times year Kelly Gulliver have observed a general change in the way in which many people will bring already been dependent on “scambling” in earlier times seasons Dependence on Qualification When selecting a secure For the-range gambling establishment Why Ignition Is one of Acknowledged Online local casino taking Defense Why Ignition Is among the most Acknowledged Internet casino getting Protection Such trial designs are an excellent option for trying out a game title title prior to gaming actual cash in it n Yax Azrbaycan Kazinolar 2026 Yeni Oyunular n Bonuslar.2351 Lower than German gambling laws, people in the courtroom online casinos is actually subject to thirty day period-to-week put restriction regarding �step 1,100000 How can i Including a safe Internet casino in australia? Kelly Gulliver provides observed a move in the manner of numerous website subscribers enjoys started determined by “scambling” before year As to the reasons Ignition Is one of Acknowledged On-line casino to own Safeguards Legal Land having Online gambling in australia VAVADA Вавада казино официальный сайт регистрация вход.3041 And this Bitcoin gambling establishment provides from prompt cashouts, with a lot of crypto withdrawals produced in merely times! As to the reasons Ignition Is the most Most readily useful Internet casino to have Safeguards