This will give you 3 new options while searching: 1. Display All Posts (standard and default) 2. Display Last Posts (like .classic I guess) 3. Display Main Posts (like something somewhere)
This is based on JustDave's mod for 6.2 and 6.4 seems to make it even easier to do this so here it is.
Credits: chillin, DaLanTech, Photopost and Omegatron
Files Altered: search.tmpl, dosearch.tmpl, search.php(language files) and dosearch.php
New Files: None
Database Altered: N/A
Info/Instructions:
UPDATED TO INCLUDE INSTRUCTIONS FOR 6.4.1 with the new search parameters.
Disclaimer: Please backup every file that you intend to modify. If the modification modifies the database, it's a good idea to backup your database before doing so.
Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Well the way it is it seems to pull all replies to a thread.
People report that it did not work in 6.3 but it did in 6.2
I have a 6.2 dosearch.php but see no reason or difference where it would break it. I have tried a few things. However for the most part I was just happy to update the mod to be able to break apart main threads from replies when searching.
I am continually searching for the difference in 6.2 versus 6.3,6.4 that causes this to break but then I never ran this to 6.2 to confirm it worked correct there.
Well unfortunately that may be about the only way to do it is to compare with a LEFT JOIN on the posts table.
I updated the hack with a variation of your hack as I felt it was not needed to double check the t1.B_Approved twice.
But it does work as intended with one exception. Since your using B_Main IS NULL you will also pull in any posts with no replies. However this is much preferable than showing all replies to a thread.
It's working for me, but I do get some slowdowns when things get busy. Since "today's active topics" is an absolute requirement, I can't take it off to really test the speed. If this is the slowdown issue, anyone have any good ideas to dealing with this better?
While working on this last night i think i crashed mysql on my shared server, sorry host!
There has to be a better way to do this.... i've been lookin at postlist.php to see how they grab the last poster on a thread for clues, but I'm not getting anything.
frustrating. anyone know why this is no longer functional? eg what changes have been made?
I updated the mod to take advantage of Rick's suggestions
Now the only display thing I do not like is that it returns the main thread but when you click it does take you to the last post. It does also have the posterid and time set right as well. Would be nice to figure out how to show the true last post though.
Rokken! That is working like a charm. I haven't installed the YASM yet but tweaked my "module" in Mambo, and changed the IIP Pal for Current Threads and both are working wonderfully.
Personally I like having the original thread name displayed... the "old" way just showed a bunch of Re: BLAH this looks much more clean.
I have attached my currenthreads.pal as a text file if anyone wants it.
my vigilant users found a few bugs in the script. when searching using $displaytype = "last" the post time was incorrect (it was showing the original post time, not the last reply) and the user link to the last poster profile was linking to the Original poster's profile. picky, picky!
I have attached the corrections to the mod that fixes both issues above.
I got it to work on Da Forum, but I'm having trouble creating hyperlink to the lasy posts -and I think it's due to the way that the $Forum variable is being handled. The default past 24 hour display link on the main index is:
Good to know since the way that date ranges are handled is different in 6.4
What I tried to do is just add &displaytype=Last to the end of that link. Unfortunately all I get are the last posts in the forums that are open to everyone -and not the forums that you have to be registered to view. I know it's not a problem with the last posts querry in the dosearch.php file since the "Display all last Posts" in the search.php script works.
I think it's a problem with the way that the $Forum variable is handled in the 6.4 version of dosearch.php. In the old version the $Forum variable was generated by a get input function ($Forum = get_input("Forum","both");), now it's an array and you can't pass All_Forums in a url -or if you can it's not working, or not checking to see if you are registered.
This would be much easier if the last posts were a part of Threads...
yeah i have it working fine at my site, pm me if you need some more help, but be sure to try re-applying the .txt file on the first post as it has changed/updated with scream's suggestions
Ok, I went and reapplied all that stuff (missed some) and it looks a lot better. The only thing that isn't right now is the body preview... Any ideas on fixing this up? I guess this would involve a lot of new queries?
Any way to get it working "properly"? Ie display the teaser or the "last post"? It really confuses people when the teaser doesn't apply the the post in question.
So far no. The link is correct but all the ways people have come up with can kill servers as it would have to scan the entire post table to get the true lastpost. That is in essense what I did to get it to truly work. I added a left join on the post table to scan again and compare and get the last post but as you saw that on busier sites was a killer.
[]Omegatron said: So far no. The link is correct but all the ways people have come up with can kill servers as it would have to scan the entire post table to get the true lastpost. That is in essense what I did to get it to truly work. I added a left join on the post table to scan again and compare and get the last post but as you saw that on busier sites was a killer. [/]
ya, this is the killer I am running up against. My users absolutly love the last post thing, but you are right, it is killing my board. I'm going to try without a preview for a few days and see how it works.
I guess the other thing to do would be to have a cron drive a query and update a table every 5 minutes with the proper data and just have it retrieved from there. Fred
If you do a cron task every 5 minutes you will really kill your server worse. Usually on a cron task everything else on your server shuts down until the cron is over.
The search mod already has the ability to preview body. changing the body to the last post body should just be a query change to grab the lastpost body instead of main post.
This mod works fine with 6.4.1. Go to my forums and search
The main change in 6.4.1 was to place a selected="selected" statement in the search template which by default only shows posts from the last week. Now if you broaden the search paramter you will find it works very well. I get all main posts and last posts in the time frame I select. So I dont know what your doing wrong.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.