News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Recent.php

Started by blsilks, December 09, 2004, 11:37:22 AM

Previous topic - Next topic

blsilks

Is there an easy way to make the Recent.php only pull the most recent posts from a perticular board only instead of the entire messageboard system?

[Unknown]

Find:

// Find the 10 most recent messages they can *view*.
$request = db_query("
SELECT m.ID_MSG
FROM {$db_prefix}messages AS m, {$db_prefix}boards AS b
WHERE b.ID_BOARD = m.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
AND $user_info[query_see_board]
ORDER BY m.ID_MSG DESC
LIMIT 10", __FILE__, __LINE__);


Replace:
// Find the 10 most recent messages they can *view*.
$request = db_query("
SELECT m.ID_MSG
FROM {$db_prefix}messages AS m, {$db_prefix}boards AS b
WHERE m.ID_BOARD = ##
AND b.ID_BOARD = ##
AND $user_info[query_see_board]
ORDER BY m.ID_MSG DESC
LIMIT 10", __FILE__, __LINE__);


Where ## is the board's number.

-[Unknown]

blsilks

#2
Ok, I went and entered in your code and its not showing the ten most recent posts from board 2.  Its showing only one post from board 2 and if I post something new to board 2 then it only shows the new post. 

blsilks

OK  you see that ! in front of the = sign?  I forgot to delete that.  HAHAHAHA  now it works.

blsilks

Is there an easy way to make it so that on the recent page, it displays like maybe the first 5 lines of the post instead of the entire post?

[Unknown]

You can do this in the template by just showing only the first part of the body, or by using max-height in supporting browsers.

-[Unknown]

Advertisement: