dozent_get_discussion_by_id( $discussion_ID )
Parameters
- $discussion_ID
-
(Required)
Return
(array|object|void|null) Get any discussion by ID, either any main question or it's could be a discussion reply.
Source
File: includes/core-functions.php
function dozent_get_discussion_by_id($discussion_ID) { global $wpdb; $questions = $wpdb->get_row("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, course_id_meta.meta_value as course_ID, course.post_title as course_title, lecture.ID as lecture_ID, lecture.post_title as lecture_title, comment_user.display_name as user_display_name, comment_user.user_nicename as user_nicename, (SELECT COUNT(replies.comment_ID) FROM {$wpdb->comments} replies WHERE replies.comment_parent = comments.comment_ID ) reply_count FROM {$wpdb->comments} comments LEFT JOIN {$wpdb->postmeta} course_id_meta ON comments.comment_post_ID = course_id_meta.post_id AND course_id_meta.meta_key = '_dozent_course_id' LEFT JOIN {$wpdb->posts} course ON course_id_meta.meta_value = course.ID LEFT JOIN {$wpdb->posts} lecture ON comments.comment_post_ID = lecture.ID LEFT JOIN {$wpdb->users} comment_user ON user_id = comment_user.ID WHERE 1 = 1 AND comments.comment_ID = {$discussion_ID} AND comments.comment_type = 'dozent_discussion' ORDER BY comments.comment_date ;"); return $questions; }