/** * 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 To tackle on Safer AUS Casinos on the internet � Professional Tips and tricks The property is actually had and you can operated by the Cheyenne and you may Arapaho Tribes off Oklahoma Trustly � inside ihr Spielsalon superschnell, ungenannt & gewiss walten Why Ignition Is among the most Better Internet casino taking Cover To play contained in this Safe AUS Online casinos � Top-notch Tricks and tips The newest constant and you will expanding deal with suggests a reliable and you can engaged betting populace Kelly Gulliver will bring seen a general change in ways of numerous clients keeps been influenced by “scambling” in past times seasons Sweepstakes casino poker isn’t the just like regulated genuine?currency online poker Lower than German gambling legislation, users regarding legal web based casinos is actually subject to a beneficial month-to-week deposit restriction out of �step 1,one hundred thousand As to why Ignition Is the most Top Sites gambling enterprise for Defense What are Your internet Casino Account for the Western Virginia In the SafeCanada, i work with taking Canadian individuals honest, outlined study of safer web based casinos Right here, you can find ports, movies black-jack, as well as on the brand new likes of NetEnt, Microgaming, and you can Play’n Go Zero KYC Crypto Casinos: An informed Anonymous Bitcoin Gambling enterprises 2026 dos. Hemorrhoids O’ Gains � Trusted On-line casino around australia delivering Pokies Here, you can find ports, movies black-jack, plus regarding your enjoys of NetEnt, Microgaming, and you may Play’n Wade Bonuses and will be offering during the on-line casino within the Kuwait Gambling enterprise Under German gaming rules, professionals inside judge online casinos is subject to a monthly put restriction from �step one,000 This type of demonstration items are great for tinkering with a great-games prior to betting cash on it Proponents argued you to court bling platforms perform make good income tax cash (over $three hundred mil per year, predicated on certain quotes) Safer financial is a vital element of somebody on the internet real money gambling enterprise Safer monetary is a vital element of one on the web a genuine earnings gambling establishment Allege The No deposit Bonus during the Nj: A leap-by-Action Guide Baccarat – while the talked about of your Seymour regarding the 1897 People can also be earn immediate coin falls, haphazard employer battles, and you may regular experience incentives Safe financial is a vital component of any on the web a real income casino To try out in the Safer AUS Casinos on the internet � Expert Tricks and tips While they are not often the high wide variety, bettors can use them in an effort to enjoy a free choice Secure banking is an essential part of people on the web real bucks local casino All of our Required Safer Casinos on the internet To possess 2025 Maine Wagering: The best Maine Playing Internet sites to own 2026 Best 5 Respected Online gambling Sites in the usa � Compared Just how Canadian Social Protection Create Would Online Bettors Different ways be certain that conformity that have legal conditions having sweepstake casinos To try out throughout the Safer AUS Web based casinos � Expert Tips and tricks Brand new Demanded Safer Web based casinos To have 2025 Safer financial is a vital section of you to definitely on the web a beneficial actual income gambling enterprise Guide to Locating the best Louisiana Internet casino Web sites How do i Choose a secure Internet casino in australia? Particular now offers additionally include a maximum cashout cap, have a tendency to anywhere between $fifty and you may $2 hundred Baccarat – because the discussed in the Seymour during the 1897 My personal Local casino Possibilities Criteria: How i Separate Winners out of Losers Uk people can experience numerous games having fun with cellular gambling establishment apps and internet Kelly Gulliver enjoys seen a general change in exactly how of many participants will bring started influenced by “scambling” previously year Including most of the over, always prioritize safety and security If you are looking for visible factual statements about every aspect of the latest casino’s undertaking, next look no further than Ignition Gambling establishment Specialization video game give a fun transform away from rate and often function book legislation and you may bonus enjoys Roulette is well-known options yes into the-range gambling establishment Table Game 2. Hemorrhoids O’ Gains � Trusted Towards-range local casino around australia getting Pokies Home