admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'aimslms_curriculum' ), ) ); } /* * ======================= * RENDER UI * ======================= */ /** * Render the curriculum builder markup: existing sections/lessons plus the "Add Section" control. * * @param WP_Post $post Course post being edited. */ public static function render( $post ) { global $wpdb; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Custom table, no WP API alternative. $sections = $wpdb->get_results( $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is derived from $wpdb->prefix, not user input. "SELECT * FROM {$wpdb->prefix}aimslms_course_sections WHERE course_id = %d ORDER BY sort_order ASC", $post->ID ) ); $sections_count = ! empty( $sections ) ? count( $sections ) : 0; ?>
get_results( $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is derived from $wpdb->prefix, not user input. "SELECT * FROM {$wpdb->prefix}aimslms_course_lessons WHERE section_id = %d ORDER BY sort_order ASC", $section->id ) ); $lessons_count = ! empty( $lessons ) ? count( $lessons ) : 0; ?>