dozent_get_discussion_replies( int $question_ID, int $start, string $limit = '-1' )


Parameters

$question_ID

(int) (Required)

$start

(int) (Required)

$limit

(string) (Optional)

Default value: '-1'


Return

(array|object|null) Get discussion replies


Source

File: includes/core-functions.php

	function dozent_get_discussion_replies($question_ID = 0, $start = 0, $limit = '-1')
	{
		global $wpdb;

		if (!$question_ID) {
			return [];
		}

		$limit_query = '';
		if ($limit != '-1') {
			$limit_query = " LIMIT {$start}, {$limit} ";
		}

		$replies = $wpdb->get_results("SELECT 
        comments.comment_ID, 
        comments.comment_post_ID, 
        comments.comment_author, 
        comments.comment_date, 
        comments.comment_date_gmt, 
        comments.comment_content, 
        comments.comment_approved as comment_status, 
        comments.comment_parent, 
        comments.user_id, 
        comment_user.display_name as user_display_name, 
        comment_user.user_nicename as user_nicename
        
        FROM {$wpdb->comments} comments
        LEFT JOIN {$wpdb->users} comment_user ON user_id = comment_user.ID
        
        WHERE 1 = 1 AND comments.comment_parent = {$question_ID} AND comments.comment_type = 'dozent_discussion' 
        ORDER BY comments.comment_date DESC {$limit_query} ;");

		return $replies;
	}

Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.