Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Mod Name / Version: Yet Another Search Mod 2.1

Description: Yet Another Search Mod 2.0

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.

You can see a demo at my site

http://www.reeftalk.com/ubbthreads/search.php

Working Under: UBB.Threads 6.4

Mod Status: Beta

Any pre-requisites:

Author(s): JustDave

Date: 12/10/03

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.
Attachments
101595-YASM2.1.txt (0 Bytes, 131 downloads)

Sponsored Links
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Thanks for updating this one


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
works great, thank you.

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Funny thing is, my users wouldnt understand what "Display All Last Posts" and "Display All Main Posts" mean. lol

Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
possible modification:

Display All Main Posts =

display threadname as result only
display threads where result was found

Sponsored Links
Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
Seems:
2. Display Last Posts (like .classic I guess)

Isn't working. I did a hack for it in 6.3, but it wasn't elegant. Any ideas on updating this better?

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
Prior to 6.3 B_last_post and B_posted were only equal in th elast post. Since 6.3 the two fields are always equal.


I managed to get it to work in 6.3 by doing this:
https://www.ubbdev.com/forum/showflat.php?Cat=0&Board=php&Number=88035#Post88035

I was hoping someone came up with a more elegant way, as it's not a great hack I did and feel it could be sped up a bit somehow.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
werd! glad to find this one updated! thanks omegatron

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Actually someone specifically asked for it so I dusted it off.

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
hmmm my db is not liking the left join business...

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Thanks works great

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
[]chillin said:
hmmm my db is not liking the left join business... [/]

I can't use it either -the last posts takes almost a minute to generate on my forum

Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
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?

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Since the search function was changed a good deal in 6.4 - I think this mod needs the queries reworked or it'll bury 6.4 sites. Rick offers suggestions here:
https://www.ubbdev.com/forum/showthreaded.php/Cat/0/Number/102369

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125

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.

Thanks for the help everyone.
Attachments
102411-currentthreadspal.txt (0 Bytes, 29 downloads)

Last edited by chillin; 12/18/2003 4:52 PM.
Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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.

Last edited by Omegatron; 12/20/2003 7:33 AM.
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Thanks first post updated with changes. Verified and accurate.

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
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:

Code
 http://www.dalantech.com/ubbthreads/dosearch.php?Cat=&Forum=All_Forums&Words=&daterange=1&newertype=d&newerval=1&Limit=25 


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...

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
[]
This would be much easier if the last posts were a part of Threads... [/]

AMEN! But then we wouldn't be having all of this fun

Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
Has anyone been able to get it working correctly with the indexing AND displaying the right post information in the search results for "last"?

I haven't and feel it's been causing me a lot of grief with 6.4 as it so soo much slower due to this.:(

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
This has been working fine with the last post information. Was updated over a week ago with suggested code by the master Scream himself

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Dalantech try something like this

http://www.reeftalk.com/ubbthreads/dosea...st&Limit=25

All_Forums works fine for me and the displaytype=last as well.

Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
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?

PS, here is a current sample on reeftalk:
http://www.reeftalk.com/ubbthreads/dosea...&bodyprev=1

It displays a preview of the first topic and not the last.

Last edited by VWDerf; 12/30/2003 2:09 PM.
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Yes with Ricks fixes the first is the one displayed.

Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Oct 2002
Posts: 71
Power User
Power User
Offline
Joined: Oct 2002
Posts: 71
[]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

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
I've got it showing the preview of the latest post - a sorta "active topics" deal, but I can't tell if it's gonna kill things. How do I tell?


This is what I have for the page:
Generated in 0.051 seconds in which 0.006 seconds were spent on a total of 11 queries. Zlib compression enabled.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Okay cool, well I'm just gonna use it then, cause it works. If it kills things, I'll take it down.

I guess I didn't understand stuff in this thread then...nevermind!

Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
This new YASM dosn't work with 6.4.1
There are differences in the new selects and changes in the original dosearch.php

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
I try two times to hack. dosearch.php give me an error in line 487 after try. In your instructions you write:

## Change this:

$query ="
SELECT t1.B_Number,t1.B_Main,t3.U_Username,t1.B_Subject,t1.B_Posted,t1.B_Board,t3.U_Color,t1.B_Reged,t1.B_Icon,t2.Bo_Title,t2.Bo_Read_Perm,t2.Bo_Cat,t1.B_Posterid,t1.B_Status,t1.B_AnonName,t1.B_Body

but in 6.4.1 the select looks like:

SELECT t1.B_Number,t1.B_Main,t3.U_Username,t1.B_Subject,t1.B_Posted,t1.B_Board,t3.U_Color,t1.B_Reged,t1.B_Icon,t1.B_Posterid,t1.B_Status,t1.B_AnonName,t1.B_Body


I try to remove t2.Bo_Title,t2.Bo_Read_Perm,t2.Bo_Cat from the hack but this dosnt work too. There must be something different.

Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
The error message i get every time:
Parse error: parse error, unexpected T_ELSE in /home/www/web17/html/dclan/ubbthreads/dosearch.php on line 486

Page 1 of 2 1 2

Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)