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
Switch to threaded view of this topic Create a new topic Submit Reply
Search for Attachments [message #162852] Fri, 13 August 2010 07:45 Go to next message
alopezie is currently offline  alopezie   Germany
Messages: 106
Registered: September 2003
Karma: 1
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
Re: Search for Attachments [message #162859 is a reply to message #162852] Fri, 13 August 2010 18:05 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Great work! Your patch was committed and will be part of the upcoming FUDforum 3.0.2 release.

For details, see http://fudforum.svn.sourceforge.net/fudforum/?rev=4979&view=rev

Best regards.

Frank
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: My News hack
Next Topic: mods for pay
Goto Forum:
  

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

Current Time: Sat Nov 23 23:19:44 GMT 2024

Total time taken to generate the page: 0.02527 seconds