Save 10% off all website scripts! - Enter code SNOWBALL at checkout!
Free Web Site Evaluations
Home » Scriptalicious Blog » Scripts » vBulletin Similar Threads in PHP

Scriptalicious Blog

vBulletin Similar Threads in PHP

Posted 2009-04-18 in Scripts

Scriptalicious Blog

This is a completely portable PHP script that fetches similar threads from a vBulletin forum. It does not require global.php or any other vBulletin scripts to run. The script uses full score matching, and supports search engine friendly URLs made by vBSEO and other custom formats.

A little background first. I could have used the built-in vBulletin functions, specifically fetch_similar_threads(), but that means invoking the vBulletin codebase with global.php from my scripts. The overhead of this just doesn’t seem necessary to grab a few threads, but I did not want to settle for a simple wildcard search and preferred score matching with the vBulletin fetch_similar_threads() function. In order to support custom search engine friendly URLs from vBSEO you need to include additional code to use the vbseo_any_url() function.

Not to mention, including vBulletin’s global.php isn’t as simple as it sounds. Errors are numerous under certain circumstances, and it simply doesn’t work under others. And if you want to fetch from a different server altogether… well you’re out of luck. Since I plan on invoking this script on every page load from a separate domain, I needed a better solution. Something portable and easy to customize.

With this in mind, I created a function vb_get_similar_threads(). This adapts the fetch_similar_threads() function in vBulletin and vbseo_any_url() function from vBSEO to an independent function that can be put in any PHP script with no extra include()’s or overhead.

Basically, you pass vb_get_similar_threads() a keyphrase string and the function connects to the vBulletin database and performs a full score matching search, returning all the matching threads as an array with formatted URLs.

Full instructions and usage examples are provided in the source code below. Feel free to use this for any purposes, but leave the copyright notice intact if you release any changes. There is no warranty on the code whatsoever. Save the source below to functions_vb_similarthreads.php on your server and modify it as needed.

functions_vb_similarthreads.php:





 


Search



Subscribe


Subscribe via RSS

Stay current with Scriptalicious news and subscribe in your favorite RSS reader.

Subscribe by RSS

Subscribe via Email

Get the latest Scriptalicious news delivered to your inbox.




77 powerful SEO scripts for under $100.

Real-time Backlink Rank Checker script.


Scriptalicious is in no way affiliated with myspace.com® or Google®. Google, PageRank™ and MySpace are the trademarks of their owners.