PM Search 1.00 MOD - Posted (1894 Views)
Advanced Member
Etymon
Posts: 2396
2396
Download Location: SnitzBitz
This is a modified standard Snitz search.asp. This MOD allows a member to search for keywords in his/her inbox, outbox, or inbox and outbox. It also lets the member search in the title or the entire PM.
Currently, this MOD is set up for searching only the private messages that the member has sent or received.
If you are an administrator and you want to search your members' mailboxes in addition to your own, contact me, and I'll work that into a future version as an option.
The .zip contains only one file: pm_search.asp. I can include instructions for installing it, an image icon, and also search terms highlighting in the next version. There are no database upgrades and no additional files. It uses the same files as search.asp. You'll have to make a link to it for now. Remember, this is just the first version.
My username at SnitzBitz is WhoHasItWhere. <
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Advanced Member
Carefree
Posts: 4224
4224
See your EMail. I sent you a revision.<
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Etymon, line 328 in the pm_search.asp may need updating, it put you back to search.asp.
Also I have noticed that if I search in the Inbox only, I will not come back with a returned result, but if I select the Outbox or the Inbox and Outbox from the drop down I get results back. Great work on it by the way.<
Cheers,

David Greening
Posted
Advanced Member
Etymon
Posts: 2396
2396
Thanks guys for the help! I'll take a look at it as soon as I can. smile<
Posted
Average Member
modifichicci
Posts: 787
787
to fix it:
lines 251 -258
Code:

	if cLng(Request.Form("SearchPM")) = 0 then
strSql3 = strSql3 & " AND P.M_OUTBOX= " & cLng(Request.Form("SearchPM")) & " "
elseif cLng(Request.Form("SearchPM")) = 1 then
strSql3 = strSql3 & " AND P.M_OUTBOX= " & cLng(Request.Form("SearchPM")) & " "
elseif cLng(Request.Form("SearchPM")) = 2 then
strSql3 = strSql3 & " AND (P.M_OUTBOX = 1 "
strSql3 = strSql3 & " OR P.M_OUTBOX = 2) "
end if

changed to:
Code:

if cLng(Request.Form("SearchPM")) = 1 then
strSql3 = strSql3 & " AND P.M_OUTBOX= 0 AND (P.M_TO = " & MemberID & "))"
elseif cLng(Request.Form("SearchPM")) = 2 then
strSql3 = strSql3 & " AND P.M_OUTBOX= 1 AND (P.M_FROM = " & MemberID & "))"
elseif cLng(Request.Form("SearchPM")) = 3 then
strSql3 = strSql3 & " AND (P.M_OUTBOX = 0 "
strSql3 = strSql3 & " OR P.M_OUTBOX = 1) AND (P.M_FROM = " & MemberID & " OR P.M_TO = " & MemberID & ")) "
end if


lines 503 - 511
Code:

	if OutBox_ID = "0" then
Response.Write "privatesent.asp"
elseif OutBox_ID = "1" then
Response.Write "privateread.asp"
elseif OutBox_ID = "2" and Topic_Author = MemberID then
Response.Write "privatesent.asp"
elseif OutBox_ID = "2" and Topic_Recipient = MemberID then
Response.Write "privateread.asp"
end if

changed to:
Code:

if OutBox_ID = 2 then
Response.Write "privatesent.asp"
elseif OutBox_ID = 1 then
Response.Write "privateread.asp"
elseif OutBox_ID = 2 and Topic_Author = MemberID then
Response.Write "privatesent.asp"
elseif OutBox_ID = 1 and Topic_Recipient = MemberID then
Response.Write "privateread.asp"
elseif OutBox_ID = 3 then
Response.Write "privateread.asp"
end if

lines 628 - 630
Code:

	"                	<option value=""0"">Inbox</option>" & vbNewLine & _
" <option value=""1"">Outbox</option>" & vbNewLine & _
" <option value=""2"">Inbox and Outbox</option>" & vbNewLine

changed to
Code:

	"                	<option value=""1"">Inbox</option>" & vbNewLine & _
" <option value=""2"">Outbox</option>" & vbNewLine & _
" <option value=""3"">Inbox and Outbox</option>" & vbNewLine

I think that lines from 564 to 562 could be deleted
the same for lines from 516 to 528
the same for lines from 446 to 465
line 328 :
change search.asp to pm_search.asp<
Posted
Advanced Member
Etymon
Posts: 2396
2396
Change the following from this:

Code:
		if cLng(Request.Form("SearchPM")) = 0 then
strSql3 = strSql3 & " AND P.M_OUTBOX= " & cLng(Request.Form("SearchPM")) & " "
elseif cLng(Request.Form("SearchPM")) = 1 then
strSql3 = strSql3 & " AND P.M_OUTBOX= " & cLng(Request.Form("SearchPM")) & " "
elseif cLng(Request.Form("SearchPM")) = 2 then
strSql3 = strSql3 & " AND (P.M_OUTBOX = 1 "
strSql3 = strSql3 & " OR P.M_OUTBOX = 2) "
end if

to this:

Code:
		if cLng(Request.Form("SearchPM")) = 0 then
strSql3 = strSql3 & " AND (P.M_FROM <> " & MemberID & ")"
elseif cLng(Request.Form("SearchPM")) = 1 then
strSql3 = strSql3 & " AND (P.M_TO <> " & MemberID & ")"
end if

Note that if you send a message to yourself, this doesn't account for that. tongue
modifichicci, I haven't tried your fix. The code above will show the messages in your inbox, outbox, and inbox/outbox. You may be fixing some other errors along the way that I haven't discovered. smile Thanks for your help too!<
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Etymon,

your fix worked nice and easy. Now getting results from the search. <
Cheers,

David Greening
Posted
Advanced Member
Etymon
Posts: 2396
2396
Originally posted by Classicmotorcycling
Etymon,

your fix worked nice and easy. Now getting results from the search.

Thanks David!
CareFree has packaged together a really nice installation guide with a pic for the search and some other fixes and tweaks of his own. When We get these errors all corrected, I'll upload the newest version of the MOD to SnitzBitz. smile
Thank again for all the help guys/gals! <
Posted
Advanced Member
Etymon
Posts: 2396
2396
For anyone who is interested in testing the next unofficial version(s), contact me through my forum member profile e-mail here at Snitz (You have to login first tongue ). We're throwing around some ideas via e-mail.<
Posted
Average Member
modifichicci
Posts: 787
787
That is true.. but it search only in outbox or only in inbox, i think it's missed the double option.. but I could be wrong.. you have to change also lines 503-511 to point to the correct link and lines 628-630 if you abort double check..
Edit: I haven't tryed your fix but are you sure that setting the query to P.M_FROM <> " & MemberID or P.M_TO <> " & MemberID you don't restrict the search to member PM but it takes on all PM?
Because the select command is bring on the PM table, with only a WHERE on subject or message and then you query on P.M_FROM that is NOT members bringing on the search or P.M_TO that is NOT the same members
<
Posted
Advanced Member
Carefree
Posts: 4224
4224
The latest version (that I just mailed back to Etymon) searches in/out/both boxes and restricts members to their own PMs. Works just the way it should.<
You Must enter a message