UBB.Dev
Ok ... first I will preface this to say I am VERY new to this whole hacking thing, and I dont understand any of it ... just ask Josh. hehehe

For most of my forums on my sites I want to have the normal topic order as the default view ... newest topics with replies on top, etc. However, there are certian forums that I want to have different, or unique topic viewing.

1) I would like to have topics in order of when the initial post starter was made (newest to oldest). For instance, this would be for news. So, the most recent news post would be on top. Right now, if a person replies to a news topic that is from 2 weeks ago, it puts that on top of the listing, and that is not what I want.

2) I would like to have topics ordered by alpha (A - Z). This would be for a databased style forum. The order would not change when replies are added. For instance, for my gaming site, each topic would be the name of a game and in alpha order ... like:

RalliSport Challenge
Rally Fusion: Race Of Champions
Rayman Arena
RedCard Soccer 2003
Roller Coaster Tycoon
Run Like Hell

etc.....

Thanks! I am sure I will have more questions as we go along. I am still unsure exactly everything that I want to do with the structure, but this will be a good start.
That is doable.

I did something similar for Coy7 at www.IyariLimon.com

Bascially you're going to hack around in postlist.php

Haven't looked at any code, but here's my guess.

For number one, I would add an "if" statement to override the "dateslip" check. The way you describe in #1 is how it functions with dateslip off. The posts stay in their order.

For number 2, you'd use an "if" statment, to see if it's a certain board, you'll alter the "ORDER BY" line of the query.

It would change to
"ORDER BY t1.B_Subject ASC"
I believe.
You can easily sort a forum alphabetically by subject by clicking the SUBJECT link in the topic page (postlist).

Here is the URL to sort this forum alpha, ascending:

Code
<br />https://ubbdev.com/forum/postlist.php?Cat=&Board=php&page=0&view=collapsed&sb=2&o=<br />


So you could just append the extra "&page=0&view=collapsed&sb=2&o=" to the URL for those forums you want sorted in this fashion in to your UBBTHREADS.TMPL file.

In UBBTHREADS.TMPL find:
Code
<br /><a href="{$config['phpurl']}/postlist.php?Cat=$Cat&amp;Board={$forum[$c][$f]['Keyword']}"><br />


Change it to:
Code
<br /><a href="{$config['phpurl']}/postlist.php?Cat=$Cat&amp;Board={$forum[$c][$f]['Keyword']}{$forum[$c][$f]['SortBy']}"><br />


$forum is an multi-dimensional array that holds display and organization info about each forum. We are going to add an entry in that array called "SortBy" and stick our sort info in it, and then append it to the URL on the forums page.

Then open UBBTHREADS.PHP and find:
Code
<br />$forum[$x][$y]['Keyword'] = $Keyword;<br />


After that add:
Code
<br />if ($Keyword == "XXXX") {<br />    $forum[$x][$y]['SortBy'] = "&page=0&view=collapsed&sb=2&o=";<br />}<br />else {<br />    $forum[$x][$y]['SortBy'] = "";<br />}<br />


Replace XXXX with the Keyword of the forum you want to sort. If you want to sort more than one forum alphabetically by subject, the just change the "if" statement to:
Code
<br />if (($Keyword == "XXXX") || ($Keyword == "YYYY")) {<br />


That will make is so that the forums identified by the keywords you specify will be sorted alpha, ascending when the user clicks on the link to open the forum.

Hope that helps!



Thanks. I am not up to speed today, so I am going to wait until I have a clear head before I try this ... I will post back here when I do with more questions or response.
No worries. Let me know if you need help.
Ok .. bringing a topic up from the past (forgot about this).

This worked, thanks.

NOW ... what about:

Another option I am looking into is having a forum stay in order of date and time the initial topic post is created, but still allow people to reply. I want people to be able to reply to the topic and always be able to , but if someone replies to a topic from last month, it will bump it up to the top above more recent topics, and I do not want that. Basically, I want most recent topics created (not replied to) at top , decending to the last one created. This would only be for a couple forums, not all... for instance, a site news forum. I do not want to do this to all the forums.

Thanks.
Posted By: JoshPet Re: Forcing unique topic view order per forum - 06/13/2004 1:19 AM
Basically you want to shut dateslip off on a per forum basis.

This should work -in postlist.php - after the get_input stuff.

Code
<br />if ($Board == "keyword") {<br />   $config['dateslip'] = 0;<br />}<br />


Where I have "keyword" use the real keyword for the board. Then the posts will remain in order by date posted. (Dateslip will be off in that forum. )
Hey Josh, can you point me where specifically I need to put that? Do I need to replace anything? Also, what about multiple forums that I want that for?

Thanks man.
Posted By: JoshPet Re: Forcing unique topic view order per forum - 06/13/2004 1:39 AM
Add it after the get_input lines at the top. After this:

$o = get_input("o","both");



If you have more than one board -

if (($Board == "keyword") || ($Board == "keyword2")) {

instead of that other "if" line I posted.
Thanks Josh! Can I bug you for ONE MORE THING ?

I want to change the "Subject Poster Views Replies Last post" links to just text ... meaning that since I am forcing the way each forum is being viewed, those do not need to be "clickable" and changable, but the text needs to be there for column labelling. I am assuming I edit the postlist.tmpl deal, but I cannot figure out what to edit out without screwing it up.

Help please?

Thank you.
Posted By: JoshPet Re: Forcing unique topic view order per forum - 06/13/2004 4:25 AM
In the postlist.tmpl - it's plain HTML, you'll find each comment has code like this:

<a href="{$config['phpurl']}/postlist.php?Cat=$Cat&Board=$Board&page=$page&view=$view&sb=$sortsubject&o=$o">
{$ubbt_lang['SUBJECT_TEXT']}
</a>


Remove the <a href..... > part and the </a> from each column heading.
Thanks ... I was doing that in a text editor, and it wasn't working, so I just did it via the control panel and it works.

Thanks again for your help!
© UBB.Developers