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 :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Search for Attachments [message #162852] Fri, 13 August 2010 03:45 Go to next message
alopezie is currently offline  alopezie   Germany
Messages: 90
Registered: September 2003
Karma: 1
Member
add to buddy list
ignore all messages by this user
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 14:05 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
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
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: My News hack
Next Topic: mods for pay
Goto Forum:
  

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

Current Time: Sat Oct 21 08:25:31 EDT 2017

Total time taken to generate the page: 0.00658 seconds