Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Search Thread Details »»
Search Thread
Version: 1.00, by Erwin Erwin is offline
Developer Last Online: May 2013 Show Printable Version Email this Page

Version: 2.3.x Rating:
Released: 10-28-2002 Last Update: Never Installs: 82
 
No support by the author.

Search Thread - by Erwin Loh
-----------------------------

This hack will add a "Search This Thread" search box at the bottom of threads (similar to the "Search This Forum" search box at the bottom of Forum Display).

Should be useful for loooooooooooooong threads, especially for a forum like this one.


Demo
-------

This hack is installed here at vB.org - just use the Search This Thread box at the bottom right hand corner of this page.


Features
-----------

1. Only posts from the thread will be searched.
2. Uses that standard searchindex table.
3. Uses the same vB search algorithms.
4. This will add NO extra queries to your forum.
5. Uses the standard search and forum permissions set by you.


Installation
------------

1. Running 1 database query
2. Making 2 changes to showthread.php
3. Making 6 changes to search.php
4. Making 1 change to template "showthread"
5. Adding a new template "showthread_searchthread"

Enjoy!

Please click install if you want updates to this hack!

Dr. Erwin Loh

I've updated the installation text file to make things clearer, and made the search box visible to guests as well.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 10-29-2002, 01:35 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by X-Fan
Oops, got a database error whilst doing a search on this thread at my site:

http://x-mencomics.com/xfan/forums/s...threadid=12350

Mmm... that's strange. Make sure you follow the installation instruction exactly - they can be tricky - don't double up on code - some of the code are meant to replace, some are to be added. I assume you ran the db query as well.
Reply With Quote
  #13  
Old 10-29-2002, 02:04 AM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep, ran the DB query, and all code additions/changes are as they should be.
Reply With Quote
  #14  
Old 10-29-2002, 02:11 AM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, the code in my search.php for step 4 is as follows:

PHP Code:
    $getpostids=$DB_site->query("
        SELECT
          post.postid, thread.visible"
.
          
iif(strlen(strpos($orderbysql","posttext")),",IF(post.title='',LEFT(post.pagetext,50),post.title) AS posttext","").
          
iif(strlen(strpos($orderbysql","usrname")),",IF(post.userid=0,post.username,user.username) AS usrname","").
          
"
        FROM
          post"
.
          
iif(strlen(strpos($search[query],"searchindex")),",searchindex","").
      
iif(strlen(strpos($orderbysql","thread.")) or strlen(strpos($search[query],"thread.")) or strlen(strpos($orderbysql,"forum.")) or strlen(strpos($search[query],"forum."))," LEFT JOIN thread ON thread.threadid=post.threadid ","").
          
iif(strlen(strpos($orderbysql","forum.")) or strlen(strpos($search[query],"forum."))," LEFT JOIN forum ON thread.forumid=forum.forumid ","").
          
iif(strlen(strpos($orderbysql","usrname"))," LEFT JOIN user ON (post.userid=user.userid) ","").
          
"
        WHERE
          post.visible=1 AND thread.visible=1 AND 
$searchthreadquery $newpostsql $search[query]
                    ORDER BY
          
$orderbysql
        LIMIT "
.($limitlower-1).",$perpage
        "
); 
and for step 5 it's:

PHP Code:
    $sql="
    SELECT
      post.postid,post.title AS posttitle,post.dateline AS postdateline,post.userid AS postuserid,post.iconid AS posticonid,LEFT(post.pagetext,250) AS pagetext,
      thread.threadid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,thread.views,thread.pollid,thread.open,thread.lastpost,
      forum.forumid,forum.title AS forumtitle,forum.allowicons,user.username,
      IF(post.title='',LEFT(post.pagetext,50),post.title) AS posttext,
      IF(post.userid=0,post.username,user.username) AS usrname,
      posticon.iconpath AS posticonpath,posticon.title AS posticontitle,
      threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle
    FROM
      post"
.iif(strpos($search[query],"searchindex")>0,",searchindex","").",thread
    LEFT JOIN forum ON forum.forumid=thread.forumid
    LEFT JOIN user ON user.userid=post.userid
    LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
    LEFT JOIN icon AS posticon ON post.iconid=posticon.iconid
    WHERE
      
$postids AND $searchthreadquery thread.threadid=post.threadid
    ORDER BY
      
$orderbysql"
Does that look right to you?
Reply With Quote
  #15  
Old 10-29-2002, 02:19 AM
Okiewan's Avatar
Okiewan Okiewan is offline
 
Join Date: Dec 2001
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this follow user group options for searches?
Reply With Quote
  #16  
Old 10-29-2002, 02:22 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That looks right. And you REPLACED the relevant sections in your search.php. Make sure you are replacing the correct sections - there are 2 similar sections, one for "threadonly" and one for "showposts" - replace the SECOND lot, not the first lot in search.php - ie. the exact piece of code you are meant to find in the instructions (one reason why I ask to find a huge chunk of code to replace - there are 2 similar sections).
Reply With Quote
  #17  
Old 10-29-2002, 02:22 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Okiewan
Does this follow user group options for searches?
Yes.

If guests are not allowed to search, they won't be able to. Private forum posts will remain hidden. All forum permissions are intact.
Reply With Quote
  #18  
Old 10-29-2002, 02:29 AM
Okiewan's Avatar
Okiewan Okiewan is offline
 
Join Date: Dec 2001
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very cool.
Thanks, nice hack.
Reply With Quote
  #19  
Old 10-29-2002, 02:32 AM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Erwin
That looks right. And you REPLACED the relevant sections in your search.php. Make sure you are replacing the correct sections - there are 2 similar sections, one for "threadonly" and one for "showposts" - replace the SECOND lot, not the first lot in search.php - ie. the exact piece of code you are meant to find in the instructions (one reason why I ask to find a huge chunk of code to replace - there are 2 similar sections).
Yep, that's what I did, and it's not working. I've double-checked the hack installation, and I've followed your instructions to the letter, but I'm still getting that DB error.
Reply With Quote
  #20  
Old 10-29-2002, 04:02 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

NOTE:
----------

I've updated the installation text file to make the instructions clearer and easier.

Also, I changed the way the code is like in showthread.php to make the search box viewable by guests.

However, the search box will still follow search and forum permissions. If guests are not allowed to search, they won't be able to. Private forum permissions will be intact as well.

Download the new text file and see if it helps.
Reply With Quote
  #21  
Old 10-29-2002, 04:14 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alright, just managed to fixed up some of the text font problems and carriage returns in the installation text file.

Instructions now document 6 changes in the search.php file instead of 5 - I have made all the changes SMALLER and EASIER to do and follow.

Download the new searchthread1.txt now.

I have also uploaded a new screenshot.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07044 seconds
  • Memory Usage 2,328KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete