EssaysReportsGenerator::addAdditionalFields( $strFields )
Add additional field sql statement
Description
Source
File: bp-integrations/learndash/buddypress/generators/EssaysReportsGenerator.php
public function addAdditionalFields($strFields) { global $wpdb; $quizPostType = learndash_get_post_type_slug('quiz'); $fields = " users.ID as user_id, users.display_name as user_display_name, users.user_email as user_email, {$wpdb->posts}.ID as essay_id, {$wpdb->posts}.post_title as essay_title, {$wpdb->posts}.post_date_gmt as essay_post_date, {$wpdb->posts}.post_modified_gmt as essay_modify_date, {$wpdb->posts}.comment_count as essay_comment_count, ( SELECT meta_value FROM {$wpdb->postmeta} as pro_quiz_meta WHERE pro_quiz_meta.post_id = {$wpdb->posts}.ID AND pro_quiz_meta.meta_key = 'quiz_pro_id' ) as pro_quiz_id, ( SELECT post_id FROM {$wpdb->postmeta} as quiz_meta INNER JOIN {$wpdb->posts} as qm_posts ON qm_posts.ID = quiz_meta.post_id WHERE quiz_meta.meta_key = 'quiz_pro_id' AND quiz_meta.meta_value = pro_quiz_id and qm_posts.post_type = '{$quizPostType}' ) as quiz_id, ( SELECT quizes.post_title FROM {$wpdb->posts} as quizes WHERE quiz_id = quizes.ID ) as quiz_title, ( SELECT meta_value FROM {$wpdb->postmeta} as course_meta WHERE course_meta.post_id = {$wpdb->posts}.ID AND course_meta.meta_key = 'course_id' ) as activity_course_id, ( SELECT post_title FROM {$wpdb->posts} as courses WHERE activity_course_id = courses.ID ) as activity_course_title, IF ({$wpdb->posts}.post_status = 'graded', {$wpdb->posts}.post_modified, 0) as activity_completed "; return $fields; }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.