Enrol
Source
File: Model/Enrol.php
class Enrol extends Model { protected $table = 'dozent_enrols'; public $ID; public $course_id; public $user_id; public $course_price; public $order_id; public $order_by_product_id; public $status = 'pending'; public $created_at; public $expired_at; /** * Do the enrolment of the course * * long description * * Example usage: * * $enrolment = dozent_enrolment(); * $enrolment->course_id = $course_id; * $enrolment->user_id = $user_id; * $enrolment->do_enrol(); * * * @since DozentLMS 1.0.0 * * */ public function do_enrol() { do_action( 'dozent_enrolment_before' ); $is_enrolled = $this->save(); do_action( 'dozent_enrolment_after', $is_enrolled ); } /** * Update Enrolment status * * * @since DozentLMS 1.0.0 * * * @param $new_status */ public function update_status( $new_status ) { $old_status = $this->status; if ( $old_status !== $new_status ) { $this->status = $new_status; $this->save(); /** * Action hook to after update enrolment status * * @since DozentLMS v.1.0.0 * * @param int $ID enrolment ID * @param string $old_status Current status of this enrolment * @param string $new_status New Enrolment Status * @param object $this Current enrolment data as model object */ do_action( 'dozent_enrolment_status_updated', $this->ID, $old_status, $new_status, $this ); } } }
Methods
- do_enrol — Do the enrolment of the course
- update_status — Update Enrolment status