@@ -465,6 +465,8 @@ function moodleoverflow_print_forum_list($course, $cm, $movetopopup) {
465465 $ forumarray = [[]];
466466 $ currentforum = $ DB ->get_record ('moodleoverflow_discussions ' , ['id ' => $ movetopopup ], 'moodleoverflow ' );
467467 $ currentdiscussion = $ DB ->get_record ('moodleoverflow_discussions ' , ['id ' => $ movetopopup ], 'name ' );
468+ $ modinfo = get_fast_modinfo ($ course ->id );
469+ $ instances = $ modinfo ->get_instances_of ('moodleoverflow ' );
468470
469471 // If the currentforum is anonymous, only show forums that have a higher anonymous setting.
470472 $ anonymoussetting = $ DB ->get_field ('moodleoverflow ' , 'anonymous ' , ['id ' => $ currentforum ->moodleoverflow ]);
@@ -485,17 +487,20 @@ function moodleoverflow_print_forum_list($course, $cm, $movetopopup) {
485487
486488 if ($ amountforums >= 1 ) {
487489 // Write the moodleoverflow-names in an array.
488- $ i = 0 ;
489490 foreach ($ forums as $ forum ) {
490491 if ($ forum ->id == $ currentforum ->moodleoverflow ) {
491492 continue ;
492- } else {
493- $ forumarray [$ i ]['name ' ] = $ forum ->name ;
494- $ movetoforum = $ CFG ->wwwroot . '/mod/moodleoverflow/view.php?id= ' . $ cm ->id . '&movetopopup= '
495- . $ movetopopup . '&movetoforum= ' . $ forum ->id ;
496- $ forumarray [$ i ]['movetoforum ' ] = $ movetoforum ;
493+ } else if (empty ($ instances [$ forum ->id ]->deletioninprogress )) {
494+ $ movetourl = new moodle_url ('/mod/moodleoverflow/view.php ' , [
495+ 'id ' => $ cm ->id ,
496+ 'movetopopup ' => $ movetopopup ,
497+ 'movetoforum ' => $ forum ->id ,
498+ ]);
499+ $ forumarray [] = [
500+ 'name ' => $ forum ->name ,
501+ 'movetoforum ' => $ movetourl ->out (false ),
502+ ];
497503 }
498- $ i ++;
499504 }
500505 $ amountforums = true ;
501506 } else {
0 commit comments