With your hack, you will display all private forum threads, if they match the text. You need to use perms for this in order to make it efficient.
I install it, but heavily modified based on forum perms.
Here it is the code I used:
Code:
$similarthreads = '';
$similarthreadbits = '';
$threadscount = 0;
$forumperms = $DB_site->query("
SELECT forumid,canview
FROM forumpermission
WHERE usergroupid=$bbuserinfo[usergroupid]
");
while ( $forumperm = $DB_site->fetch_array( $forumperms ) )
{
$ipermcache["$forumperm[forumid]"] = $forumperm;
}
$DB_site->free_result( $forumperms );
unset( $forumperm );
$getforums = $DB_site->query("
SELECT forumid,parentid,displayorder
FROM forum
WHERE displayorder<>0 AND active=1
ORDER BY parentid,displayorder
");
while ( $getforum = $DB_site->fetch_array( $getforums ) )
{
$iforumcache["$getforum[parentid]"]["$getforum[displayorder]"]["$getforum[forumid]"] = $getforum;
if ( !isset( $ipermcache["$getforum[forumid]"]['canview'] ) )
{
$iforumperms[] = $getforum['forumid'];
}
}
$DB_site->free_result( $getforums );
unset( $getforum );
if ( !empty( $iforumperms ) )
{
$iforumperms = 'AND thread.forumid IN( ' . implode( ',' , $iforumperms ) . ' )';
}
$otherthreads = $DB_site->query("
SELECT thread.threadid,thread.forumid,thread.title,thread.replycount,thread.postusername,forum.title as forumtitle
FROM thread
LEFT JOIN forum ON( forum.forumid=thread.forumid )
WHERE MATCH( thread.title ) AGAINST( '" . addslashes( $thread['title'] ) . "' )
AND thread.visible=1
AND thread.open<>10
AND thread.threadid<>$thread[threadid] $iforumperms
ORDER BY dateline DESC LIMIT 5
");
while ( $otherthread = $DB_site->fetch_array( $otherthreads ) )
{
$threadscount++;
eval( '$similarthreadbits .= "' . gettemplate( 'showthread_similarthreadbit' ) . '";' );
}
if ( !empty( $threadscount ) )
{
eval( '$similarthreads = "' . gettemplate( 'showthread_similarthreads' ) . '";' );
}
Feel free to use it in your install file.

BTW, thanks for a great hack!