mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Major gain in efficiency for the latest news block and better styles
Still working on more improvements here
This commit is contained in:
parent
7270d81fad
commit
90ec387a54
5 changed files with 93 additions and 32 deletions
|
@ -1214,7 +1214,7 @@ function forum_count_unrated_posts($discussionid, $userid) {
|
|||
}
|
||||
|
||||
function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
|
||||
$user=0, $fullpost=true, $visiblegroups=-1) {
|
||||
$user=0, $fullpost=true, $visiblegroups=-1, $limit=0) {
|
||||
/// Get all discussions in a forum
|
||||
global $CFG;
|
||||
|
||||
|
@ -1224,6 +1224,11 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
|
|||
$userselect = "";
|
||||
}
|
||||
|
||||
if ($limit) {
|
||||
$limit = " LIMIT $limit ";
|
||||
} else {
|
||||
$limit = "";
|
||||
}
|
||||
|
||||
if ($visiblegroups == -1) {
|
||||
$groupselect = "";
|
||||
|
@ -1252,7 +1257,7 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
|
|||
AND p.parent = 0
|
||||
AND p.userid = u.id $groupselect $userselect
|
||||
AND (d.usermodified = um.id OR d.usermodified = 0)
|
||||
ORDER BY $forumsort");
|
||||
ORDER BY $forumsort $limit");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue