473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IPB and search by forum_id

I have a php mod that I'm using on an Invision Power Board. It's to search for unanswered topics. The problem is that it was designed to search for "all" and I need to be able to filter them by forum_id.

This is what I had:
Expand|Select|Wrap|Line Numbers
  1.         $this->ipsclass->input['forums']  = '7 9 10 31 19 26 28 13 15 20 48 21 16 52';
  2.  
  3.  
  4.         $forums = $this->get_searchable_forums();
  5.  
  6.         $mid    = intval($this->ipsclass->input['mid']);
  7.  
[Please use CODE tags when posting source code. Thanks! --pbmods]

But now it's only searching the first forum and ignoring the rest. How do I get it to include all forums I listed?

Thanks
Jun 22 '07 #1
3 3197
code green
1,726 Expert 1GB
I'm mystified too.
I suggest you study how this 'IPB' class works.
It is impossible to solve without this knowledge and I have never heard of it
Jun 22 '07 #2
This is the mod if it helps:
Expand|Select|Wrap|Line Numbers
  1. function get_unanswered()
  2.  
  3.     {
  4.  
  5.  
  6.     //-----------------------------------------
  7.         // Do we have flood control enabled?
  8.         //-----------------------------------------
  9.  
  10.         if ($this->ipsclass->member['g_search_flood'] > 0)
  11.         {
  12.             $flood_time = time() - $this->ipsclass->member['g_search_flood'];
  13.  
  14.             //-----------------------------------------
  15.             // Get any old search results..
  16.             //-----------------------------------------
  17.  
  18.             $this->ipsclass->DB->simple_construct( array( 'select' => 'id',
  19.                                                             'from'   => 'search_results',
  20.                                                             'where'  => "(member_id='".$this->ipsclass->member['id']."' OR ip_address='".$this->ipsclass->input['IP_ADDRESS']."') AND search_date > '$flood_time'" ) );
  21.             $this->ipsclass->DB->simple_exec();
  22.  
  23.             if ( $this->ipsclass->DB->get_num_rows() )
  24.             {
  25.                 $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_flood', 'EXTRA' => $this->ipsclass->member['g_search_flood']) );
  26.             }
  27.         }
  28.  
  29.         $this->ipsclass->input['forums'] = 'all';
  30.  
  31.         $forums = $this->get_searchable_forums();
  32.  
  33.         $mid    = intval($this->ipsclass->input['mid']);
  34.  
  35.         //-----------------------------------------
  36.         // Do we have any forums to search in?
  37.         //-----------------------------------------
  38.  
  39.         if ($forums == "")
  40.         {
  41.             $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
  42.         }
  43.  
  44.  
  45.         //-----------------------------------------
  46.         // Get the topic ID's to serialize and store into
  47.         // the database
  48.         //-----------------------------------------
  49.  
  50.  
  51.         $this->ipsclass->DB->simple_construct( array( 'select' => 'count(*) as count', 'from' => 'topics t', 'where' => "t.approved=1 AND t.forum_id IN($forums) AND t.posts=0" ) );
  52.         $this->ipsclass->DB->simple_exec();
  53.  
  54.         $row = $this->ipsclass->DB->fetch_row();
  55.  
  56.         $results = intval($row['count']);
  57.  
  58.         //-----------------------------------------
  59.         // Do we have any results?
  60.         //-----------------------------------------
  61.  
  62.         if ( ! $results )
  63.         {
  64.             $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
  65.         }
  66.  
  67.         //-----------------------------------------
  68.         // Cache query
  69.         //-----------------------------------------
  70.  
  71.  
  72.  
  73.         $this->ipsclass->DB->simple_construct( array( 'select' => 't.*, t.title as topic_title',
  74.                                       'from'   => 'topics t',
  75.                                       'where'  => "t.approved=1 AND t.forum_id IN($forums) AND t.posts=0",
  76.                                       'order'  => "t.last_post DESC" ) );
  77.  
  78.  
  79.         $query_to_cache = $this->ipsclass->DB->cur_query;
  80.         $this->ipsclass->DB->flush_query();
  81.  
  82.         //-----------------------------------------
  83.         // If we are still here, store the data into the database...
  84.         //-----------------------------------------
  85.  
  86.         $unique_id = md5(uniqid(microtime(),1));
  87.  
  88.         $this->ipsclass->DB->do_insert( 'search_results', array (
  89.                                                   'id'          => $unique_id,
  90.                                                   'search_date' => time(),
  91.                                                   'post_max'    => $results,
  92.                                                   'sort_key'    => $this->sort_key,
  93.                                                   'sort_order'  => $this->sort_order,
  94.                                                   'member_id'   => $this->ipsclass->member['id'],
  95.                                                   'ip_address'  => $this->ipsclass->input['IP_ADDRESS'],
  96.                                                   'query_cache' => $query_to_cache
  97.                                          )        );
  98.  
  99.         $this->ipsclass->boink_it( $this->ipsclass->base_url."act=Search&nav=au&CODE=show&searchid=$unique_id&search_in=topics&result_type=topics" );
  100.  
  101.  
  102.     }
  103.  
  104.  
If you look you can see where it is set to search forum = 'all'
What I am trying to get it to do is search by the unique id of each forum. It was working and then it stopped and I have no idea why. Is there anyway to get it to search all forums instead of just the first one using php code?
Jun 23 '07 #3
code green
1,726 Expert 1GB
I don't quite understand your problem and honestly don't have time to wade through lots of code. If you can narrow down and define the problem I will gladly help if I can
Jun 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been...
10
by: Anand Pillai | last post by:
To search a word in a group of words, say a paragraph or a web page, would a string search or a regexp search be faster? The string search would of course be, if str.find(substr) != -1:...
1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
5
by: George | last post by:
Hi, Anyone has the background for explaining? I have made a search on my name and I have got a link to another search engine. The link's title was the search phrase for the other search engine...
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
28
by: joshc | last post by:
If I have an array of data that I know to be sorted in increasing order, and the array is less than 50 elements, and I want to find the first element greater than a certain value, is a simple...
4
by: BenCoo | last post by:
Hello, In a Binary Search Tree I get the error : Object must be of type String if I run the form only with the "Dim bstLidnummer As New BinarySearchTree" it works fine. Thanks for any...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
0
by: passion | last post by:
"Specialized Search Engines" along with Google Search Capability (2 in 1): http://specialized-search-engines.blogspot.com/ Billions of websites are available on the web and plenty of extremely...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.