Commit f05f9a6a authored by Josh Schmidt's avatar Josh Schmidt Committed by Richard Mansfield
Browse files

Bug fixes on forum indenting

(cherry picked from commit 4b67fc500857aeb5ff03cb0f4f94fccebd4b9c99)
parent 84b1d6b7
......@@ -62,7 +62,7 @@ define('GROUP', $topic->groupid);
$membership = user_can_access_forum((int)$topic->forumid);
$moderator = (bool)($membership & INTERACTION_FORUM_MOD);
$forumconfig = get_records_assoc('interaction_forum_instance_config', 'forum', $topicid, '', 'field,value');
$forumconfig = get_records_assoc('interaction_forum_instance_config', 'forum', $topic->forumid, '', 'field,value');
$indentmode = isset($forumconfig['indentmode']) ? $forumconfig['indentmode']->value : 'full_indent';
$maxindentdepth = isset($forumconfig['maxindent']) ? $forumconfig['maxindent']->value : 10;
......@@ -263,15 +263,17 @@ function renderpost($post) {
*/
function buildflatposts(&$posts) {
buildsubjects(0, '', $posts);
$localposts = $posts;
$first_post = array_shift($localposts);
if (!isset($first_post->subject) || empty($first_post->subject)) {
$first_post = get_string('re', 'interaction.forum', '');
$first_post->subject = get_string('re', 'interaction.forum', '');
}
$children = array();
foreach ($localposts as $index => $post) {
if (!isset($post->subject) || empty($post->subject)) {
$post->subject = get_string('re', 'interaction.forum', $first_post->subject);
}
$children[] = $post;
}
$first_post->children = $children;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment