hi
When i choose to show, say, only 20 posts in the shoutbox; it will show the 20 FIRST post and no the 20 lasts ones. It is quite anoying....
I have a quick hack to do so:
in shoutbox.module, line 449 ( after " $color = 0; " ),
replace the line $result = db_query("SELECT * FROM {shoutbox} WHERE status=1 ORDER BY created LIMIT %d", $show_amount);
by the lines:
$all_rows = db_query("SELECT * FROM {shoutbox} WHERE status=1");
$nb_rows = db_num_rows($all_rows);
$start_row = $nb_rows - $show_amount;
if ($start_row < 0)
{
$start_row = 0;
}
$result = db_query("SELECT * FROM {shoutbox} WHERE status=1 ORDER BY created LIMIT $start_row,$nb_rows);
Hope it will help
Charly
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | shoutbox_last_posts.patch.txt | 863 bytes | jonhattan |
Comments
Comment #1
jonhattanI've fixed it looking at the code in 4.6 version:
$show_start = count_shouts() - $show_amount;
if ($show_start < 0) {
$show_start = 0;
}
$result = db_query("SELECT * FROM {shoutbox} WHERE status=1 ORDER BY created LIMIT %d, %d", $show_start, $show_amount);
attached is a patch
Comment #2
jonhattanooops. anyway, attached was a patch :)
Comment #3
robrepp commentedHad the same problem, patch worked fine. See http://drupal.org/node/60108 for detailed instructions on how to apply patches.
Comment #4
cgiscripts4u commentedok why not just order the database in descending order ie change line 446 from
$result = db_query("SELECT * FROM {shoutbox} WHERE status=1 ORDER BY created LIMIT %d", $show_amount);to
$result = db_query("SELECT * FROM {shoutbox} WHERE status=1 ORDER BY created desc LIMIT %d", $show_amount);This will show the last entry first.
Greg
Comment #5
disterics commentedDon't think this is currently a problem in HEAD. Open this if its still an issue.