Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 107

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 234

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 235

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 236

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 237

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 238

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 239
* @link https://themeum.com * @since 1.7.1 */ namespace TUTOR; use WP_REST_Request; if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class REST_Topic * * @package Tutor * * @since 1.7.1 */ class REST_Topic { use REST_Response; /** * Post parent ID. * * @var int $post_parent The ID of the post parent. */ private $post_parent; /** * Post type. * * @var string $post_type The post type for topics. */ private $post_type = 'topics'; /** * Retrieve topics by course ID via REST API. * * @param WP_REST_Request $request The REST request object. * * @since 1.7.1 * * @return mixed */ public function course_topic( WP_REST_Request $request ) { $this->post_parent = $request->get_param( 'course_id' ); if ( ! isset( $this->post_parent ) ) { $response = array( 'code' => 'get_topic', 'message' => __( 'course_id is required', 'tutor' ), 'data' => array(), ); return self::send( $response ); } global $wpdb; $result = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_title, post_content, post_name FROM {$wpdb->posts} WHERE post_type = %s AND post_parent = %d", $this->post_type, $this->post_parent ) ); if ( count( $result ) > 0 ) { $response = array( 'code' => 'get_topic', 'message' => __( 'Topic retrieved successfully', 'tutor' ), 'data' => $result, ); return self::send( $response ); } $response = array( 'code' => 'not_found', 'message' => __( 'Topic not found for given course ID', 'tutor' ), 'data' => array(), ); return self::send( $response ); } }