CourseBuilder::sorting_curriculum_items()
Sorting curriculum Items
Source
File: classes/CourseBuilder.php
public function sorting_curriculum_items() { global $wpdb; $sections = dozent_input_array_field( 'sections' ); if ( dozent_count( $sections ) ) { $item_i = 1; foreach ( $sections as $skey => $section ) { $section_id = dozent_array_get( 'section_id', $section ); //Sorting Section $wpdb->update( $wpdb->posts, [ 'menu_order' => $skey ], [ 'ID' => $section_id ] ); $item_ids = dozent_array_get( 'item_ids', $section ); if ( dozent_count( $item_ids ) ) { foreach ( $item_ids as $ikey => $item_id ) { $wpdb->update( $wpdb->posts, [ 'post_parent' => $section_id, 'menu_order' => $item_i ], [ 'ID' => $item_id ] ); $item_i ++; } } } } }
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |