Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'wip-MDL-19147-MOODLE_20_STABLE' of git://github.com/abg…

…reeve/moodle into MOODLE_20_STABLE
  • Loading branch information...
commit 8eaf6d689b0916d6435920b4e588b6504952e816 2 parents 4828564 + a6da7bd
@samhemelryk samhemelryk authored
Showing with 10 additions and 2 deletions.
  1. +9 −2 mod/forum/discuss.php
  2. +1 −0  mod/forum/lang/en/forum.php
View
11 mod/forum/discuss.php
@@ -86,6 +86,10 @@
print_error('cannotmovetonotexist', 'forum', $return);
}
+ if ($forumto->type == 'single') {
+ print_error('cannotmovetosingleforum', 'forum', $return);
+ }
+
if (!$cmto = get_coursemodule_from_instance('forum', $forumto->id, $course->id)) {
print_error('cannotmovetonotfound', 'forum', $return);
}
@@ -221,18 +225,21 @@
if (isset($modinfo->instances['forum'])) {
$forummenu = array();
$sections = get_all_sections($course->id);
+ // Check forum types and eliminate simple discussions.
+ $forumcheck = $DB->get_records('forum', array('course' => $course->id),'', 'id, type');
foreach ($modinfo->instances['forum'] as $forumcm) {
if (!$forumcm->uservisible || !has_capability('mod/forum:startdiscussion',
get_context_instance(CONTEXT_MODULE,$forumcm->id))) {
continue;
}
-
$section = $forumcm->sectionnum;
$sectionname = get_section_name($course, $sections[$section]);
if (empty($forummenu[$section])) {
$forummenu[$section] = array($sectionname => array());
}
- if ($forumcm->instance != $forum->id) {
+ $forumidcompare = $forumcm->instance != $forum->id;
+ $forumtypecheck = $forumcheck[$forumcm->instance]->type !== 'single';
+ if ($forumidcompare and $forumtypecheck) {
$url = "/mod/forum/discuss.php?d=$discussion->id&move=$forumcm->instance&sesskey=".sesskey();
$forummenu[$section][$sectionname][$url] = format_string($forumcm->name);
}
View
1  mod/forum/lang/en/forum.php
@@ -64,6 +64,7 @@
$string['cannotmovenotvisible'] = 'Forum not visible';
$string['cannotmovetonotexist'] = 'You can\'t move to that forum - it doesn\'t exist!';
$string['cannotmovetonotfound'] = 'Target forum not found in this course.';
+$string['cannotmovetosingleforum'] = 'Cannot move discussion to a simple single discussion forum';
$string['cannotpurgecachedrss'] = 'Could not purge the cached RSS feeds for the source and/or destination forum(s) - check your file permissionsforums';
$string['cannotremovesubscriber'] = 'Could not remove subscriber with id {$a} from this forum!';
$string['cannotreply'] = 'You cannot reply to this post';
Please sign in to comment.
Something went wrong with that request. Please try again.