EssaysReportsGenerator::getGroupEssays()
Load all the essays from the courses belong to the group
Description
Source
File: bp-integrations/learndash/buddypress/generators/EssaysReportsGenerator.php
protected function getGroupEssays()
{
if ($this->hasArg('course') && ! $this->args['course']) {
$courseIds = learndash_group_enrolled_courses(
bp_ld_sync('buddypress')->helpers->getLearndashGroupId($this->args['group'])
);
} else {
$courseIds = [$this->args['course']];
}
$args = [
'posts_per_page' => $this->args['length'],
'page' => $this->args['start'] / $this->args['length'] + 1,
'post_type' => learndash_get_post_type_slug('essays'),
'post_status' => $this->args['completed']? 'graded' : 'not_graded',
'meta_query' => [
[
'key' => 'course_id',
'value' => $courseIds
]
]
];
if ($this->hasArg('user') && $this->args['user']) {
$args['author'] = $this->args['user'];
}
$this->registerQueryHooks();
$query = new WP_Query($args);
$this->unregisterQueryHooks();
return $query;
}
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.