CourseBuilder::update_section()

Update Course Section


Source

File: classes/CourseBuilder.php

	public function update_section() {
		$course_id       = (int) dozent_input_text( 'course_id' );
		$section_id      = (int) dozent_input_text( 'section_id' );
		$section_name    = dozent_input_text( 'section_name' );
		$section_summery = dozent_input_textarea( 'section_summery' );

		if ( ! $section_name ) {
			wp_send_json_error();
		}


		$post_arr = apply_filters( 'dozent_update_section_attr', [
			'ID'           => $section_id,
			'post_title'   => $section_name,
			'post_content' => $section_summery,
		] );

		do_action( 'dozent/section/update/before', $course_id, $post_arr );

		wp_update_post( $post_arr );

		do_action( 'dozent/section/update/after', $course_id, $post_arr );

		ob_start();
		include DOZENT_ABSPATH . 'views/course_builder/curriculum.php';
		$course_contents = ob_get_clean();

		wp_send_json_success( [ 'curriculum' => $course_contents ] );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.