Topic: forum order of topics.

is there a way to have one forum order by the date of the topics bein posed, cuz i have a news section and its kinda out of order cuz of the comments that are made to them. so i was woudnering if there is a way. if not oh well.

2

Re: forum order of topics.

You mean order the topics according to the date the thread was started not according to the date of the last post. That way the latest news item goes to the top even if there are later replies to an earlier news item. I can see why that would be logical for a news forum. Maybe some clever person has a way to do it.

Re: forum order of topics.

ok here goes, you need to find the id of the forum you want to make the "news forum" (you can do this by looking at the number at the end of the hyperlink to go to it e.g. if the forums page was viewforum.php?id=1 the forum id would be 1)

then open viewforum.php and find (line: 126)

if ($cookie['is_guest'] || $pun_config['o_show_dot'] == '0')
{
    // Without "the dot"
    $result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
}
else
{
    // Fetch topic ID's
    $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());

and replace with

$news_id = 1;
if ( $id == $news_id ) { $order_by = "posted"; }
else { $order_by = "last_post"; }

if ($cookie['is_guest'] || $pun_config['o_show_dot'] == '0')
{
    // Without "the dot"
    $result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.$order_by.' DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
}
else
{
    // Fetch topic ID's
    $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.$order_by.' DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());

making sure you change $news_id = 1; to equal the id of the news forum e.g. $news_id = 4; etc. save and upload viewforum.php and your done

Re: forum order of topics.

I think I'll add an option for this in 1.2.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: forum order of topics.

thanx guys, and wow i feel proud to have one of my ideas to make it into punbb smile makes me feel real good hehe

Re: forum order of topics.

OffTopic smile

-Gizzmo
Website & FoRums ... you missed a letter in your signature smile

Re: forum order of topics.

why thank you snap

Re: forum order of topics.

Fixed.

"Programming is like sex: one mistake and you have to support it for the rest of your life."