MDL-42534 mod_forum: Fix issue because cm_info is read only
This commit is contained in:
+8
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user