Added some more efficiencies to the code, but something seems to be wrong

with this function as the SQL is not finding any new posts at all for me.

Needs checking!
This commit is contained in:
moodler 2006-03-15 09:56:57 +00:00
parent a328113f13
commit 9cba7a8c80

View File

@ -745,7 +745,7 @@ function forum_user_complete($course, $user, $mod, $forum) {
function forum_print_overview($courses,&$htmlarray) {
global $USER, $CFG;
if (empty($courses) || !is_array($courses) || count($courses) == 0) {
return array();
}
@ -754,9 +754,6 @@ function forum_print_overview($courses,&$htmlarray) {
return;
}
$strforum = get_string('modulename','forum');
$strnumunread = get_string('overviewnumunread','forum');
$strnumpostssince = get_string('overviewnumpostssince','forum');
// get all forum logs in ONE query (much better!)
$sql = "SELECT instance,cmid,l.course,COUNT(l.id) as count FROM {$CFG->prefix}log l "
@ -801,6 +798,14 @@ function forum_print_overview($courses,&$htmlarray) {
$unread = array();
}
if (empty($unread) and empty($new)) {
return;
}
$strforum = get_string('modulename','forum');
$strnumunread = get_string('overviewnumunread','forum');
$strnumpostssince = get_string('overviewnumpostssince','forum');
foreach ($forums as $forum) {
$str = '';
$count = 0;