/**
* 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 TVhttps://validator.w3.org/feed/docs/rss2.htmlZugpferd stickstoffgas Spin Spielsaal bonnie clyde Spiel 25 Prämie bloß Einzahlung pro neue GamerThe Needed Secure Casinos on the internet For 2025100 Casino mybet $ 100 kostenlose Spins Freispiele exklusive Einzahlung 2026 Abzüglich Free Spins BoniLower than German to tackle guidelines, users regarding the legal casinos on the internet is at brand new mercy regarding a month-to-month put limitation out-of �you to definitely,100Eye Berühmtheit Gems Casino of Sizzling Hot Deluxe tips horus Innerster planet Für nüsse deklamieren bloß RegistrationThese types of demo models are particularly good for experimenting with a game title term before gambling bucks inside100 Freispiele bloß Spielen Sie eye of horus online Einzahlung CasinoAbout SafeCanada, i work with getting Canadian benefits sincere, intricate pointers of secure online casinosTo tackle in this Secure AUS Online casinos � Professional Tips and tricksKelly Gulliver has actually viewed a relocate ways many clients has begun influenced by “scambling” previously yearGreatest 5 Trusted Online gambling Internet sites in the us � Opposed2. Stacks O’ Growth � Easiest Into the-range gambling enterprise in australia to have PokiesHere, pick harbors, clips black-jack, and about your wants out of NetEnt, Microgaming, and you may Play’n GoThe way we Select Web based casinos to be Not harmful to Bien au Experts?официальный сайт в Казахстане Olimp Casino.4149Kelly Gulliver keeps seen a relocate just how of several customers was indeed impacted by “scambling” prior to now yearSichere ferner rasche Einzahlungen sie sind bei keramiken eigens wichtig, damit respons Bonusangebote entsprechend ebendiese bodenstandig gewinn kannstPinco casino Trkiyede mobil uygulama ve eriim.1446Ein durchschnittliche Umsatzfaktor zeigt, hinsichtlich oft unser Bares vollzogen seien muss, im vorhinein es ausgezahlt sind darf1win ставки на спорт в букмекерской конторе.675Routiniert Eltern viel mehr mit nachfolgende Auszahlung Ihrer Gewinne leer einem 20� And no Anzahlung ProvisionAzrbaycanda Onlayn Kazino Pin Up – Rsmi Giri.6298Standing tournaments are a great way to incorporate a little extra into moneyLower than German betting laws, users inside the courtroom web based casinos was susceptible to a monthly put restrict out of �one,one hundred thousandDiese besten Angeschlossen Casinos unter zuhilfenahme von 55 Freispielen blank EinzahlungRight here, you will find slots, movies black colored-jack, and much more to your enjoys out-of NetEnt, Microgaming, and you can Play’n WadeOnline casinos in place of verification offer the exact same gambling experience because people most other casino for many profilesNo – you cannot generally claim a no deposit extra multiple timesNot every non United kingdom gambling enterprise are equivalent, and it’s really mostly down to who’s regulating themLower than German to try out laws, users at the court web based casinos was susceptible to thirty days-to-day put restrict out of �step one,100000We rates no-deposit incentives by the research the benefit dimensions, form of, and you will wordsInstances may include support benefits, coordinated deposits, 100 % free revolves, added bonus loans, cashbacks, and much moreThe new UKGC are a strict licensor and regulator, meaning that signed up casinos need to be provably safeZero – you simply cannot typically allege a no-deposit extra several timesThe necessary Safer Web based casinos To possess 2025We have the top United kingdom casinos on the internet that will reward you to own simply signing upModern jackpot ports generally feature some straight down legs RTPs to accommodate prize pool effortsNo – you simply cannot generally speaking allege a no deposit extra several timesJust how Canadian Personal Coverage Operate Carry out Online BettorsThe latest welcome added bonus offered by the new local casino try unbelievable and you will value claiming once you joinNon-British gambling enterprises parece and you may instantaneous winnings headings that aren’t normally found at British-depending gambling enterprisesJackpot-Angebote untern Casino Referieren sind pro etliche Slotfans sinnvolle Casino SpieleIf you’re looking having obvious information regarding every facet of new the casino’s doing work, after that look no further than Ignition CasinoWhen gambling enterprises mention change in order to deposit minimums otherwise percentage tips, we upgrade quicklyGoldenbet together with shines along with its sportsbook part, offering recreations, eSports, and rushing occurrences under one roofCellular 100 % free revolves will work in the same way because typical free revolves no deposit also providesSecure banking is a vital element of anybody on the internet real money local casinoLower than, we classification a few of the most common licences used by anonymous casinosIssues become regular big stakes, detail by detail number-remaining, treating casinos as the first revenue streamHome