/**
* 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.htmlPinco 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 streamLower than Italian words to tackle legislation, individuals from brand new legal web based casinos is at new mercy of a monthly put restriction away from �that,000The web sites give desired incentives, free spins, no-deposit bonuses, and you can respect rewardsLastly, people who worthy of restrict privacy usually choose prepaid coupon codes such as Paysafecard CasinosThese features guarantee a pleasant gambling feel, clear of rigorous limits and you will constraintsIf you are searching to possess noticeable facts about every aspect of this new casino’s performing, next take a look at Ignition Gambling establishmentNon-British casinos shall be safer if they are safely registered of the a great reputable regulatorThe new UKGC are a rigorous licensor and you can regulator, and therefore signed up gambling enterprises must be provably safeYou will always get a hold of these types of big revenue within zero minimum deposit online casinosTo German to experience statutes, profiles from the court web based casinos was subject to a monthly place limit from �one to,100Casinos on the internet give loyalty no-deposit bonuses in order to typical, going back usersMaking certain Safety and security: How Brief-Commission Online casinos Security Players’ MoneyNo minimum put is needed � bring your added bonus funds and try the fresh new game exposure-freeThey’ll state it’s a great breakdown otherwise due to the fact problems this is the reason they will not spendRight here, you can find ports, videos blackjack, including into wishes off NetEnt, Microgaming, and you may Play’n GoEffective money on ports for free try a privilege perhaps the depositing people you should never take pleasure inRegulars are not shed often – there are many constant promotions offeredThis can be being among the most worthwhile gambling establishment no-deposit added bonus even offers on the marketHome