PDA

View Full Version : Existing Topics Check


Velocd
09 Jan 2004, 05:28
http://www.animesystem.com/temp/etc1-0.jpg

This hack will allow you and your members to check for existing topics, or similar ones, of the thread you plan to create when at newthread.php.

This should help to prevent double topics that often appear from newbish members who neglect to use the search feature.

It uses the exact functions as the "similar threads" feature, therefore has the same accuracy.

Tested to work on:

vBulletin 3 RC2
Internet Explorer 6 (with Javascript enabled)
Mozilla Firebird 0.7 / Mozilla 1.5 (with Javascript enabled)


------------------------------------------------

Tweak #1

If you would like the find icon to show upon typing in the input box, and then disappear if the input box is empty upon change, please do the following:


In the template newthread, find:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Replace it with:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



In the same template, find:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Replace it with:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



------------------------------------------------

Attached is a screenshot.

Inside the zip are English, German, and French installation instructions. Please be aware I used a software translator for the German and French docs.

Enjoy. ;)

MrNase
09 Jan 2004, 12:26
Hey very cool :)

albibak
09 Jan 2004, 14:56
Thx Velocd for this hack.
I do the translation in french for vbulletin-fr.com and I join it on this post, because I see that you put in the zip file a speed translation by a software translator ;)

FleaBag
09 Jan 2004, 16:10
Excellent idea and wonderfully executed. I think my users will appreciate this as much as I shall.

sabret00the
09 Jan 2004, 18:19
great hack :)

NuclioN
09 Jan 2004, 18:44
--edit-- forgot a template :) Works fine

Koutaru
09 Jan 2004, 21:13
Thanks Velocd! :D

/me installs

Boofo
10 Jan 2004, 12:52
I ran into a small problem with this. I have a thread titled:

Nesting conditional statements in templates

It did not find it when I tested for the exact same phrase or conditional statements, either one. And that thread was in the same forum.

Also, the button is off before you click it the first time. Shouldn't it be on so you know it is available to click (or am I missing something here)? ;)

Velocd
10 Jan 2004, 20:12
It did not find it when I tested for the exact same phrase or conditional statements, either one. And that thread was in the same forum.

It uses the same functions as the smiilar threads feature, so if it's not finding it I'm not sure what to say.

Create two threads called "Nesting conditional statements in templates", go into one of them, and scroll to the bottom and see if the other thread shows up in the "similar threads" feature.

Also, the button is off before you click it the first time. Shouldn't it be on so you know it is available to click (or am I missing something here)?

There is an onchange Javascript behavior on the subject field, and when the subject field changes that icon becomes active. Otherwise, you don't want somebody clicking the button when the subject field is empty (although it would just give a Javascript alert box).

Boofo
10 Jan 2004, 20:33
Shouldn't the icon become active when you type soemthing in there? It only becomes active here after I click it.

And yes the title shows up in the similar threads when there are 2 of them.

I never changed any of the default settings for the similar threads in the Admin CP. Do those need to be changed, too?

Dean C
10 Jan 2004, 20:57
What a great idea! I'd love to see this installed here. :)

PranK
11 Jan 2004, 08:37
nice work mate! Thanks.

/me clicks install

Christian

Velocd
11 Jan 2004, 18:14
Shouldn't the icon become active when you type soemthing in there? It only becomes active here after I click it.

Ah ha!

Good point. I'll tweak it a bit, since that does seem more suitable.

And yes the title shows up in the similar threads when there are 2 of them.

Are both topics exactly (case-sensitive) the same? Maybe there is a case-sensitive problem in the hack.

I'll look into the code to see what could be causing the conflict of it not showing another of the same topic.

Edit:

Check out the attachment Boofo, I tested the topic on my localhost and it seems to work.

Boofo
11 Jan 2004, 18:20
Thank you, sir. Let me know when you have something and I will be glad to test it out for you. I'm really looking forward to this hack. ;)

Yes, they are exactly the same in case-sensitivity. But it wouldn't even find a part of the title either (i.e. conditional statements). ;)

Boofo
11 Jan 2004, 18:22
Ah ha!

Good point. I'll tweak it a bit, since that does seem more suitable.



Are both topics exactly (case-sensitive) the same? Maybe there is a case-sensitive problem in the hack.

I'll look into the code to see what could be causing the conflict of it not showing another of the same topic.

Edit:

Check out the attachment Boofo, I tested the topic on my localhost and it seems to work.
Could it be because they are in a private forum and passworded as to why it won't work here??

Velocd
11 Jan 2004, 18:40
Yes, if you don't have permission to view the forum those threads are in, they wont show. Although I'm guessing you do have permission since you're the administrator.

For those wanting the suggestion (http://www.vbulletin.org/forum/showpost.php?p=460156&postcount=10) made by Boofo, I've added the instructions to the tweak in the first post. ;)

Boofo
11 Jan 2004, 18:42
I don't have a lot of threads since I am starting from scratch so maybe it has to do with that then. I don't know. ;)

Boofo
11 Jan 2004, 18:47
Have the instructions been updated to include this?

Velocd
11 Jan 2004, 18:50
Have the instructions been updated to include this?
If you're referring to the tweak, no.

The tweak instructions are in the first post. ;)

buro9
14 Jan 2004, 21:56
If you're referring to the tweak, no.

The tweak instructions are in the first post. ;)
I had a very similar thing running on my old VB2 forums, I have now installed this hack on my VB3 test site... and it's nice :) Very nice.

I have made a few adjustments though:

I've used document.getElementById() rather than use IE based document.all access. This will ensure compatibility with standards compliant browsers. You need to add id="" to the relevant pieces of HTML, subject and findicon I think are the only two.

I already added an onKeyUp alongside the onChange on the subject input box. This runs it everytime a key is lifted... though I left the onChange in there as it makes no difference and ensures that more limited browsers will still support it.

Aside from that... lovely hack :)

NTLDR
14 Jan 2004, 22:41
I've used document.getElementById() rather than use IE based document.all access.

You should use fetch_object() (a vB JS function) this will give the best compatibility will all thr browsers vB supports properly.

Boofo
14 Jan 2004, 23:45
The fix in the first post works great if you type it in, but if you paste something in the thread title, it doesn't turn on the button. Any fix for this? ;)

Boofo
16 Feb 2004, 03:28
I'm getting a 406 error (object undefined) with this now after making the changes to the code in the first post. Any fix for this?

gmarik
22 Feb 2004, 09:04
nice working ...

Boofo
22 Feb 2004, 17:54
I had a very similar thing running on my old VB2 forums, I have now installed this hack on my VB3 test site... and it's nice :) Very nice.

I have made a few adjustments though:

I've used document.getElementById() rather than use IE based document.all access. This will ensure compatibility with standards compliant browsers. You need to add id="" to the relevant pieces of HTML, subject and findicon I think are the only two.

I already added an onKeyUp alongside the onChange on the subject input box. This runs it everytime a key is lifted... though I left the onChange in there as it makes no difference and ensures that more limited browsers will still support it.

Aside from that... lovely hack :)
Can you share the changes you made? ;)

buro9
22 Feb 2004, 20:55
Can you share the changes you made? ;)

Yes, I hope this won't offend the hack creator... but here are snippets of my newthread template:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------





Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Obviously I'm trusting that you can take the applicable small bits and merge them as appropriate into whatever you have.

Boofo
23 Feb 2004, 05:01
How can you get this to show the button on when you start typing in the subject filed Box (like from tthe first post)?

buro9
23 Feb 2004, 06:26
How can you get this to show the button on when you start typing in the subject filed Box (like from tthe first post)?


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



From the first key it is activated.

Though a trim() function should be added to prevent it being activated on pressing of the space bar.

Boofo
23 Feb 2004, 07:19
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



From the first key it is activated.

Though a trim() function should be added to prevent it being activated on pressing of the space bar.
How do we add the trim code to this? ;)

Boofo
23 Feb 2004, 12:01
Found a bug with this hack. If you have quotes in a thread title, you will get a javascript error when you click the button to check the topic and also the window will have the table in it without any topics. The title I used was:

"Killing all my chickens"

Any fix for this?

buro9
23 Feb 2004, 15:32
How do we add the trim code to this? ;)
To add trim you'd do something like this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



And then carry on as before.

As regards your quotes bug, it isn't apparent on my site using Firefox and IE6 to test with.

Boofo
23 Feb 2004, 15:41
I get a line 7 expected ')' error when I use the quotes in a thread title. Isn't there a way to trim any code like that in the trim statement so it only looks for words? ;) I use IE 6, by the way. ;)

buro9
23 Feb 2004, 16:04
I get a line 7 expected ')' error when I use the quotes in a thread title. Isn't there a way to trim any code like that in the trim statement so it only looks for words? ;) I use IE 6, by the way. ;)
I have just registered on your site and tested this, and I cannot generate an error.

I believe that the problem lies elsewhere... try CTRL+F5 to refreh your IE cache in case it has old files... and then look at any changes you've made to other JavaScript on the page (such as any hacks you've put into the vb supplied javascript).

I tested with "'` and all worked fine.

Line 7 also suggests something much higher in the file... maybe in one of the included files?

Cheers

David K

Boofo
23 Feb 2004, 16:21
It only seems to happen when you use the quotes with a topic that doesn't exist. It the topic exists (like "testing") then I don't get the error. If I use "killing my chickens", I get the error. Does this make any sense?

buro9
23 Feb 2004, 19:42
It only seems to happen when you use the quotes with a topic that doesn't exist. It the topic exists (like "testing") then I don't get the error. If I use "killing my chickens", I get the error. Does this make any sense?
Got it... it's here:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The double quotes aren't escaped in the javascript error message.

Boofo
23 Feb 2004, 19:46
How do we fix that? ;)

buro9
23 Feb 2004, 19:47
Got it... it's here:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The double quotes aren't escaped in the javascript error message.
Simple solution... in findtopic.php at the bottom, find:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Above it add:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Boofo
23 Feb 2004, 19:52
You are a saint! Thank you, sir. That worked great! ;)

I'm glad it wasn't my imagination. ;)

Zilvia
25 Mar 2004, 20:50
Does this work with the final release of vB 3.0.0?

Velocd
30 Mar 2004, 00:57
Yes.

TheRayden
13 Apr 2004, 19:15
Nice work. With the ammount of new people we usually receive this is going to be very usefull.

msimplay
09 May 2004, 13:25
do i need automatic similar topics search on to use this ?

chrisvonc
10 May 2004, 00:17
Velocd, working great! Thank you for releasing this hack. It was one of my favorites along with the similar topic hack for vB2.X and this helps greatly reduce the amount of double posting. I am suprised it was not added to v3. Looks to be working much stronger in vB3 than its earlier release.

As my site is geared toward non-technical people, there is a good chance a lot of them wont pick up on the search button so I just expanded the idea for the "on" gif from Tweak #1 to make it stand out a bit more for them once they typed their subject.

One thing I did notice, if you use the IE Auto-Complete feature, if you select something from one of it's entries, it doesnt toggle the search icon to ON. Not a big deal but if it can be fixed easily, I would certainly be interested in applying the fix.

Thanks again!

Chris

Eternal2u
24 May 2004, 06:15
anything to give me an excuse to say them spamming +++++es knew there was a thread for there specific thread already...

Thanks...

**Clicks Install**

Polo
13 Oct 2004, 00:38
Nice hack Velocd thanks :) and buro9, you rock those fixes were cool ;)

Justice
01 Nov 2004, 09:59
Does this hack still work for posters with search disabled? I want only certain users to be able to use the search (to save CPU), but I'd like for everyone to use this ideally.

docvader
24 Nov 2004, 19:38
Chrisvonc, how did you add the text next to the box again? It's a great idea, but I'm not very good at writing this code stuff.

Thanks.

alkatraz
26 Nov 2004, 00:33
I've just installed this on vb3.03, works great

zurih
09 Jan 2005, 15:32
installed on 3.0.5, works perfect!
thanks!

AN-net
01 Mar 2005, 20:50
installed on 3.0.7 and it works great. also modified mine so it only gets topics within the last 5 months(my forum policy is dont bump threads older than 5 months).

-=Sniper=-
03 Mar 2005, 01:11
hi, sorry I just did a quick install, and I get this

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



do I need to enable full text search?

pauloo
23 Dec 2005, 11:01
Exist for VB 3.5?

Thank you

axi
09 Feb 2006, 09:25
awesome hack.
installed.