Learnpress_Helpers::select_section_from_course_func()
Return all the sections of course ID provided in ajax call
Source
File: src/integrations/learnpress/helpers/learnpress-helpers.php
public function select_section_from_course_func() { // Nonce and post object validation Automator()->utilities->ajax_auth_check( $_POST ); $fields = array(); if ( isset( $_POST ) ) { if ( absint( $_POST['value'] ) > 0 ) { $course_curd = new LP_Course_CURD(); $sections = $course_curd->get_course_sections( absint( $_POST['value'] ) ); foreach ( $sections as $section ) { $fields[] = [ 'value' => $section->section_id, 'text' => $section->section_name, ]; } } } echo wp_json_encode( $fields ); die(); }
Expand full source code Collapse full source code View on Github