FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Search for Attachments (Simple Hack to do selective search)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Search for Attachments [message #162852] Fri, 13 August 2010 07:45 Go to previous message
alopezie is currently offline  alopezie   Germany
Messages: 106
Registered: September 2003
Karma:
Senior Member
In somecases it makes sense to limit search to posts with attachments


This can be done by changing /src/search.php.t

add ca. at Line 26:
$attach = isset($_GET['attach']) ? $_GET['attach'] : '0';


add ca. at Line 96:
	if ($GLOBALS['attach']> 0) {
		$qry_lmt .= ' AND m.attach_cnt>0';
	}


ca. Line 120


replace
	return q('SELECT u.alias, f.name AS forum_name, f.id AS forum_id,
			m.poster_id, m.id, m.thread_id, m.subject, m.poster_id, m.foff, m.length, m.post_stamp, m.file_id, m.icon, 
			mm.id AS md, (t.root_msg_id = m.id) AS is_rootm, (t.thread_opt & 1) AS is_lckd

with
	return q('SELECT u.alias, f.name AS forum_name, f.id AS forum_id,
			m.poster_id, m.attach_cnt,m.id, m.thread_id, m.subject, m.poster_id, m.foff, m.length, m.post_stamp, m.file_id, m.icon, 
			mm.id AS md, (t.root_msg_id = m.id) AS is_rootm, (t.thread_opt & 1) AS is_lckd

In fact just the addition of m.attach_cnt !

and

adding to template search.tmpl a line
<div class="sr">Attachments<br /><select class="SmallText"  name="attach" /><option selected value="0">all</option><option value="1">only with attachment</option></div>



Rebuild theme and it should be done


Alopezie.de - das Forum zum Thema Haarausfall
[Message index]
 
Read Message
Read Message
Previous Topic: My News hack
Next Topic: mods for pay
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 15:01:56 GMT 2024

Total time taken to generate the page: 0.04166 seconds