MDL-42534 mod_forum: Fix issue because cm_info is read only

This commit is contained in:
Frederic Massart
2013-10-25 11:34:10 +08:00
parent 2d2c5f36c4
commit 268bd2fe77
+8 -2
View File
@@ -8322,8 +8322,14 @@ function forum_get_posts_by_user($user, array $courses, $musthaveaccess = false,
}
// Get the forum in question
$forum = $forums[$forumid];
// This is needed for functionality later on in the forum code....
$forum->cm = $cm;
// This is needed for functionality later on in the forum code. It is converted to an object
// because the cm_info is readonly from 2.6. This is a dirty hack because some other parts of the
// code were expecting an writeable object. See {@link forum_print_post()}.
$forum->cm = new stdClass();
foreach ($cm as $key => $value) {
$forum->cm->$key = $value;
}
// Check that either the current user can view the forum, or that the
// current user has capabilities over the requested user and the requested