I fogot to mention that I use strMemberTablePrefix for buddy table. you may need to change it to strTablePrefix.
----------------------
code not changed below.
this is a samll add on for buddy mod, with which you can add a buddy by entering his/her name:
you need to have buddy mod first.
no demo yet, my site will be on by the end of the year.
just add two blocks of codes in buddy.asp
the first block is a form that could be added somewhere in the case default block in buddy.asp, or in any site pages providing you point the action to buddy.asp
<FORM METHOD=POST ACTION="buddy.asp?mode=formadd">
<TABLE>
<TR>
<TD>Add Buddy: <INPUT TYPE="text" size="50" NAME="namestoadd"> <INPUT TYPE="submit" value=" Add?>?lt;INPUT TYPE="reset">?lt;BR>
Input the member name(s) of the people you want to add as your buddy.<BR> Seperate them by comma (with no space) if you want to enter several names at the same time.</TD>
</TR>
</TABLE>
</FORM>
then add a new case
I added it below case "add"
note you need to change the path to that of your own buddy.asp. (marked in red)
also be careful of the "< %", you may or may not need it there.
Case "formadd"
dim strNamestoAdd, aryBuddyToAdd, j, intIdToAdd, strAddBuddyResult
strNamestoAdd = Request.form("namestoadd")
aryBuddyToAdd = split(strNamestoAdd, ",")
strAddBuddyResult = ""
FOR j=0 TO Ubound(aryBuddyToAdd)
intIdToAdd=""
intIdToAdd = getmemberID(trim(aryBuddyToAdd(j)))
IF intIdToAdd <> "" THEN
testSql ="SELECT * FROM "& strMemberTablePrefix & "Buddys WHERE BudMemberID=" & getmemberID(strDBNTUserName) & " and BudBudID=" & intIdToAdd
rs.Open testSql, my_Conn
If rs.BOF or rs.EOF Then
' Bookmark doesn't already exist so add it
insSql = "INSERT INTO "& strMemberTablePrefix & "Buddys (BudMemberID, BudBudID) VALUES ("
insSql = insSql & getmemberID(strDBNTUserName) & ", "
insSql = insSql & intIdToAdd & ")"
my_conn.Execute (insSql)
if j=0 then
strAddBuddyResult = strAddBuddyResult & trim(aryBuddyToAdd(j))
else
strAddBuddyResult = strAddBuddyResult & vbcrlf & trim(aryBuddyToAdd(j))
end if
End If
END IF
NEXT
%>
<br>
<center>
<p><font size="<% =strDefaultFontSize %>"><b>Buddy Added:
<%
if strAddBuddyResult = "" then
response.write"None"
else
response.write strAddBuddyResult
end if
%>
</b></font></p>
</center>
<div align="center"><font face="<% =strDefaultFontFace %>" size="2"><a href="/ffinder/buddy.asp"><br>Back to Buddy Manager<br></a></font>
</div>
<meta http-equiv="Refresh" content="2; URL=/ffinder/buddy.asp">
<P>?lt;p>?lt;p>
<%
Edited by - bjlt on 17 December 2001 10:49:24
Edited by - bjlt on 17 December 2001 13:11:07
Edited by - bjlt on 19 December 2001 04:32:02