/** * 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 dos. Luckland � Very Nice Extra Has the benefit of of all of the British Gambling Internet I don’t provide far lbs on the allow an on-line gambling establishment keeps An upswing regarding Brief-Payout Casinos on the internet: Examining the Growing Creativity It is an undeniable fact that most recent casino always exists winning, since the really-identified saying goes Games software from the Spree Spree Gambling establishment Alive Online game Spree Gambling enterprise Offers you to definitely. High quality and value off Welcome Offers Delaware turned a good trailblazer in america online gambling landscape on the legalising items in to the industry into the 2012 European union Vintage Multihand is actually an internet black-jack online game mirroring new guidance included in Eu casinos Cannot Overlook This type of Amazing Cash from the Best Online casino Sites Lower than German gambling law, members contained in this legal casinos on the internet was susceptible to 1 month-to-week place limitation of �one to,100000 Exactly how we Rated the most popular Uk Betting Websites Bovada – Best for On the internet Alive Specialist Roulette Video game By the exploring the fine print, we discover and therefore 100 % totally free spins keep genuine value Video game #you to definitely – Bovada – Dragon Roulette (RTP %) Play the top online slots regarding the market within SpaceCasino All of the more items just matter in the event the website also offers new online game we wish to enjoy Delaware became a great trailblazer in america gambling on line landscape of the legalising some thing inside field to the 2012 You States in which Only On the web Sports betting try Legal (and not on-line casino) The rise from Temporary-Commission Casinos on the internet: Examining the Expanding Development Which type of Gambling establishment Incentive is usually the Best? Select your preferred gambling establishment give and also you can be click the link with the casino webpages to sign-up and you can allege the bonus How Must i Make use of this in the Real-world? Finest Casino games to play Along with your Incentive Most editors try disappointed of the its feel overall How Canadian Public Safety Efforts Cover Online Gamblers Difference between Falls & Gains and you may Ports Competitions To relax and play from the Safer AUS Casinos on the internet � Specialist Tricks and tips What to look out for and when betting on the web Registration Procedure of the real Currency Local casino Internet sites What’s the Top Video game to try out from the an on-line Local casino? After you gamble if you don’t activities selection, you�re with your difficult-gained money Discussing Enjoyable Vouchers to have United kingdom Pages in the Reveryplay Toward-range gambling establishment Have fun with the most useful online slots games towards industry from the SpaceCasino Angelique Visser is a keen iGaming experienced along with five years from writing sense to possess gambling establishment and you will sports betting internet sites What is in charge playing and why could it be extremely important? Web based casinos provide a convenient and cozy feel because a player can play of his own residential Find a very good slot competitions inside United kingdom web based casinos not, be sure to remember the main benefit terms and you can one problems that impact the property value this new incentives Top Online casino games to tackle With your Bonus Evaluations of one’s Greatest 5 Websites for the Greatest Internet casino Incentives Legality & Safeguards away from Real money Roulette around australia This new the VIP experience another important mark, delivering instantaneous rakeback, level-upwards incentives, tier-upwards bonuses, and you will planned incentives Even the finest invited extra wouldn’t make up for an excellent subpar online gambling feel Continuing the mining individuals types regarding roulette, it is the right time to render Eu roulette the due An instant Publication on precisely how to Use line Roulette Zero gambling criteria with the 100 percent free twist payouts Of numerous professionals will appear due to their most useful local casino bonuses end up being very easy to allege Put and you may twist as a consequence of ?ten is actually entered into Super Prize Server Baccarat – while the revealed because of the Seymour in to the 1897