* @return array the forum post details
* @since Moodle 2.7
*/
- public static function get_forum_discussion_posts($discussionid, $sortby = "id", $sortdirection = "ASC") {
+ public static function get_forum_discussion_posts($discussionid, $sortby = "created", $sortdirection = "DESC") {
global $CFG, $DB, $USER;
$warnings = array();
$posts[$pid]->postread = false;
}
$posts[$pid]->canreply = $canreply;
- $posts[$pid]->children = array();
if (!empty($posts[$pid]->children)) {
$posts[$pid]->children = array_keys($posts[$pid]->children);
+ } else {
+ $posts[$pid]->children = array();
}
$user = new stdclass();
'attachment' => $discussion1reply1->attachment,
'totalscore' => $discussion1reply1->totalscore,
'mailnow' => $discussion1reply1->mailnow,
- 'children' => array(),
+ 'children' => array(4),
'canreply' => true,
'postread' => false,
'userfullname' => fullname($user2)
}
if (!isset($record['mailed'])) {
- $record['mailed'] = 1;
+ $record['mailed'] = 0;
}
if (!isset($record['messageformat'])) {
- $record['messageformat'] = 1;
+ $record['messageformat'] = 0;
}
if (!isset($record['messagetrust'])) {
- $record['messagetrust'] = 1;
+ $record['messagetrust'] = 0;
}
if (!isset($record['attachment'])) {