/** * 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 Arguments culturelles du prime sans nul i� annales de quelques � : ce qu’il faut savoir It Bitcoin gambling establishment brings with regards to timely cashouts, with most crypto withdrawals lead-in only minutes! Lower than there’s the guide to get ideal casinos on the internet in almost any gambling markets Such trial designs have become great for trying out a casino game prior to betting bucks in it For the SafeCanada, we focus on taking Canadian players respectful, outlined product reviews out-of safer online casinos To play inside Secure AUS Casinos on the internet � Expert Tips and tricks The first step is to try to get the �Indication Up’ otherwise �Register’ button on the casino’s web site How we See Casinos on the internet is not bad for Au Professionals? But avec Conserve Biographies : 200� Comble parmi Absence dos. Heaps O’ Victories � Easiest On-line casino in australia for Pokies Right here, you’ll find ports, video clips black-jack, plus regarding loves from NetEnt, Microgaming, and Play’n Wade Just how Canadian Individual Security Jobs Include Online Bettors Court Land to own Gambling on line in australia Importance of Licensing Whenever choosing a safe Internet casino It Bitcoin gambling enterprise brings with respect to prompt cashouts, with most crypto distributions manufactured in simply moments! Kelly Gulliver possess noticed a change in the way of a lot customers brings been determined by “scambling” prior to now season Exactly how Canadian Social Coverage Properties Cover On line Gamblers Here, you can find ports, video black-jack, plus into wants regarding NetEnt, Microgaming, and you can Play’n Go It adds a layer of excitement that every casinos only you should never promote Need for Certification When choosing a safe Towards-range local casino Tips Favor a safe Internet casino around australia? Kelly Gulliver have seen a general change in ways of several readers attended determined by “scambling” prior to 12 months If you’re looking for clear details about every aspect of the newest fresh new casino’s operating, then look no further than Ignition Local casino Greatest 5 Trusted Online gambling Websites in the us � Compared How can i Like a safe To your-range local casino in australia? Most readily useful 5 Easiest Gambling on line Sites in the us � Compared As to the reasons Ignition Is the most Acknowledged On-line casino having Security Our Expected Secure Web based casinos Getting 2025 The online harbors catalog is sold with a combination of antique online game, modern jackpots, and you will progressive movies slots Need for Certification Whenever choosing a safe On-line casino Getting alive broker online game, the results is dependent upon the new casino’s regulations along with your history action It possess ports, desk game, and real time specialist online casino games with a high restriction bets Baccarat – because the demonstrated about Seymour when you look at the 1897 MrQ have a huge profile certainly one of online casino users, with a stronger Trustpilot rating off four Such demo designs are particularly helpful for experimenting with a-game ahead of to tackle cash on it The video game have spread pays and you will tumbling victories, having multipliers that may reach up to 500? Kelly Gulliver has actually noticed a relocate the way in which of many clients have started influenced by “scambling” prior to 12 months We have ranked the web based casinos dependent on its video game and you can have The latest UKGC handles operators and you can requires steps to end currency laundering and you may underage gambling As to why Ignition Is one of Top On the web gambling establishment which have Safeguards Licensed All of us systems render put constraints, choice limitations, go out reminders, short-term trips, and you can self-different software Ideal 5 Leading Online gambling Internet in the us � Opposed The best online casino bonuses enable you to claim big rewards Roulette was a favorite selection yes internet casino Table Games The latest technical storage or accessibility that is used simply for unknown analytical intentions Andy champions posts that assists participants create secure, informed choice and you may retains casinos to help you highest standards Secure banking is an essential section of anyone on line a real income gambling establishment Safety regarding Funds You can expect a basic out of shelter of buyers funds stored around The best aspect to consider whenever choosing a fees strategy are security and safety Home