Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Mail Author for Merge Topic Mod
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

JJenson
Advanced Member

USA
2121 Posts

Posted - 10 January 2007 :  14:17:08  Show Profile  Visit JJenson's Homepage  Reply with Quote
Ok be nice everyone first attempt at anything remotely like this.

Ok I asked Davio if I could take a shot at trying the email function on his mod. Basically I want to continue learning and this seemed like a great way and he was gracious enough to let me.

I would like to know where I have errored in my thinking on this cause I am sure there are many spots lol. Basically I have taken the original code for the emailing a person when their topic is moved and copied it and renamed the function DoAutoMoveEmailMerge and also have done this with the sub for this function. I will post code of this below. In my limited understanding of this and logic it seems like this should email someone if topic is merged.

This is the emailing function in post_info.asp

if MergeTopic then 'not implemented yet
         'Send mail to author letting him know his topic was merged with another.
         DoAutoMoveEmailMerge(allRec(Topic_ID, intOlderTopic))
         strSql  = "SELECT M.MEMBER_ID, M.M_NAME, M.M_EMAIL, T.FORUM_ID, T.T_SUBJECT "
         strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS M, " & strActivePrefix & "TOPICS T "
         strSql = strSql & " WHERE M.MEMBER_ID = T.T_AUTHOR "
         strSql = strSql & " AND T.TOPIC_ID = " & TopicNum

         set rs2 = my_Conn.Execute (strSql)

         email = rs2("M_EMAIL")
         user_name = rs2("M_NAME")
         Topic_Title = rs2("T_SUBJECT")
         ForumId = rs2("FORUM_ID")
         Usernum = rs2("MEMBER_ID")

         rs2.close

         strRecipientsName = user_name
         strRecipients = email
         strSubject = strForumTitle & " - Topic Moved"
         strMessage = "Hello " & user_name & vbNewLine & vbNewLine
         strMessage = strMessage & "Your posting on " & strForumTitle & "." & vbNewLine
         strMessage = strMessage & "Regarding the subject - " & Topic_Title & "." & vbNewLine & vbNewLine

         if not(chkForumAccess(ForumID,Usernum,false)) then
            strMessage = strMessage & "Has been removed from public display. If you have any questions regarding this, please contact the Administrator of the forum" & vbNewLine
         else
            strMessage = strMessage & "Has been moved to a new forum, You can view it at " & vbNewLine & Left(Request.Form("refer"), InstrRev(Request.Form("refer"), "/")) & "topic.asp?TOPIC_ID=" & TopicNum & vbNewLine
         end if
   %>
   <!--#INCLUDE FILE="inc_mail.asp" -->
   <%
      end if

      'ProcessSubscriptions Reply_Author, Cat_ID, Forum_ID, NewTopicID, Moderation
   else
      Go_Result "That topic does not exist in the database. Make sure the url you entered has the correct ID of the topic.", 0
   end if
   'Response.End
   Go_Result err_Msg, 1
   Response.End
end if


Here is the sub also in post_info.asp

sub DoAutoMoveEmailMerge(TopicNum)
   '## Emails Topic Author if Topic Moved.
   strSql  = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID," & strMemberTablePrefix & "MEMBERS.M_NAME, " & strMemberTablePrefix & "MEMBERS.M_EMAIL, " & strActivePrefix & "TOPICS.FORUM_ID, " & strActivePrefix & "TOPICS.T_SUBJECT "
   strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strActivePrefix & "TOPICS "
   strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strActivePrefix & "TOPICS.T_AUTHOR "
   strSql = strSql & " AND   " & strActivePrefix & "TOPICS.TOPIC_ID = " & TopicNum

   set rs2 = my_Conn.Execute (strSql)

   email = rs2("M_EMAIL")
   user_name = rs2("M_NAME")
   Topic_Title = rs2("T_SUBJECT")
   ForumId = rs2("FORUM_ID")
   Usernum = rs2("MEMBER_ID")

   rs2.close
   set rs2 = nothing
   if lcase(strEmail) = "1" then
      strRecipientsName = user_name
      strRecipients = email
      strSubject = strForumTitle & " - Topic Moved"
      strMessage = "Hello " & user_name & vbNewLine & vbNewLine
      strMessage = strMessage & "Your posting on " & strForumTitle & "." & vbNewLine
      strMessage = strMessage & "Regarding the subject - " & Topic_Title & "." & vbNewLine & vbNewLine

      if not(chkForumAccess(ForumID,Usernum,false)) then
         strMessage = strMessage & "Has been removed from public display, If you have any questions regarding this, please contact the Administrator of the forum" & vbNewLine
      else
         strMessage = strMessage & "Has been moved to a new forum, You can view it at " & vbNewLine & Left(Request.Form("refer"), InstrRev(Request.Form("refer"), "/")) & "topic.asp?TOPIC_ID=" & TopicNum & vbNewLine
      end if
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%
   end if
end sub


If someone could just point me and help me understand this a little better I would greatly appreciate it.

Thanks All

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  13:08:34  Show Profile  Visit JJenson's Homepage  Reply with Quote
Anyone have a direction to tell me to look at I don't wnat the codeing for this done at all just some ideas where I should look at and see what I can figure out?

Thanks All<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 11 January 2007 :  13:14:21  Show Profile  Visit HuwR's Homepage  Reply with Quote
what is actually going wrong ?<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  13:53:17  Show Profile  Visit JJenson's Homepage  Reply with Quote
Well Basically everything works as it should with the mod but when I try to use the code above and I have tried other vriations the topics get merged but there is supposed to be a email telling the author of the topic that it was merged with another topic. and it gives them the url to their topic.

So everything gets merged but no email is being sent.<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  14:10:01  Show Profile  Visit JJenson's Homepage  Reply with Quote
This is the newest code I have tried for this.


if MergeTopic then
         if strEmail = "1" and strMoveNotify = "1" then DoAutoMergeEmail(allRec(Topic_ID, intOlderTopic))
         strSQL = "SELECT F_SUBSCRIPTION FROM " & strTablePrefix & "FORUM WHERE FORUM_ID=" & cLng(aryForum(1))
         set rs = my_conn.execute (strSQL)
         if rs("F_SUBSCRIPTION") < 3 then
            strSQL = "DELETE FROM " & strTablePrefix & "SUBSCRIPTIONS WHERE TOPIC_ID=" & Topic_ID
            my_conn.execute(strSQL),,adCmdText + adExecuteNoRecords
         end if
         rs.close
         set rs = nothing
      end if


That is for the code to call for the sub to send the email and here is the sub code

sub DoAutoMergeEmail(TopicNum)
   '## Emails Topic Author if Topic Merged.
   strSql  = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID," & strMemberTablePrefix & "MEMBERS.M_NAME, " & strMemberTablePrefix & "MEMBERS.M_EMAIL, " & strActivePrefix & "TOPICS.FORUM_ID, " & strActivePrefix & "TOPICS.T_SUBJECT "
   strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strActivePrefix & "TOPICS "
   strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strActivePrefix & "TOPICS.T_AUTHOR "
   strSql = strSql & " AND   " & strActivePrefix & "TOPICS.TOPIC_ID = " & TopicNum

   set rs2 = my_Conn.Execute (strSql)

   email = rs2("M_EMAIL")
   user_name = rs2("M_NAME")
   Topic_Title = rs2("T_SUBJECT")
   ForumId = rs2("FORUM_ID")
   Usernum = rs2("MEMBER_ID")

   rs2.close
   set rs2 = nothing
   if lcase(strEmail) = "1" then
      strRecipientsName = user_name
      strRecipients = email
      strSubject = strForumTitle & " - Topic Moved"
      strMessage = "Hello " & user_name & vbNewLine & vbNewLine
      strMessage = strMessage & "Your posting on " & strForumTitle & "." & vbNewLine
      strMessage = strMessage & "Regarding the subject - " & Topic_Title & "." & vbNewLine & vbNewLine

      if not(chkForumAccess(ForumID,Usernum,false)) then
         strMessage = strMessage & "Has been merged with another topic, You can view it at " & vbNewLine & Left(Request.Form("refer"), InstrRev(Request.Form("refer"), "/")) & "topic.asp?TOPIC_ID=" & TopicNum & vbNewLine
      end if
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%
   end if
end sub


I really am just walking through all of this trying to get a understanding of how it works and not sure if I am on the right path or not.
<

Edited by - JJenson on 11 January 2007 14:57:12
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 11 January 2007 :  15:15:44  Show Profile  Visit HuwR's Homepage  Reply with Quote
is it getting to the mail function ? you need to put some response.write checks in your code to ascertain where it is going wrong, it is not possible to say that by just looking at a code sample. for instance is strMoveNotify = "1" etc etc<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  15:29:25  Show Profile  Visit JJenson's Homepage  Reply with Quote
Ok now to check this out I need to write something like

Response.Write strMoveNotify ="1"
Response.End

Is this what I need to do to get the information on that?<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 11 January 2007 :  15:48:29  Show Profile  Visit HuwR's Homepage  Reply with Quote
yes, then if that checks out move your response.end to find out where it gets to, you can simply do something like

response.write "I'm here"
response.end<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  16:14:46  Show Profile  Visit JJenson's Homepage  Reply with Quote
Ok will give it a shot a little later today and let you know what happens.

Thanks Huw<
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 11 January 2007 :  17:16:23  Show Profile  Reply with Quote
Jeff, this line:
if MergeTopic then
It's not my variable and I don't see you setting a value to it. So this is probably why your email code isn't running.

You should probably start that bit of email code with this:
if strEmail = "1" and strMoveNotify = "1" then
   DoAutoMergeEmail(allRec(Topic_ID, intOlderTopic))
   ...rest of code goes here
end if
<

Support Snitz Forums

Edited by - Davio on 11 January 2007 17:16:47
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  17:20:11  Show Profile  Visit JJenson's Homepage  Reply with Quote
Ahh ok I will give that a shot. My thinking on that line was that would refer back to where the code begins for the Merge Topic code. Thanks for the direction Davio and huw.<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  17:32:12  Show Profile  Visit JJenson's Homepage  Reply with Quote
ok when I do that davio I get an error. this is the error.

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/other/forum2/post_info.asp, line 2297

This is the line it is reffering to.

email = rs2("M_EMAIL")

Not sure why it would give that error on that line.

<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 11 January 2007 :  17:43:50  Show Profile  Visit HuwR's Homepage  Reply with Quote
check that you are hetting a valid value for TopicNum<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  17:47:22  Show Profile  Visit JJenson's Homepage  Reply with Quote
OK great I would do it right now but I am at work and for some reason the windows IE ftp program stopped working for me. So I will have to wait till I get home.<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 11 January 2007 :  17:55:04  Show Profile  Visit JJenson's Homepage  Reply with Quote
Ok the FTP is working again this is what I got Huw when I did the Response.Writes on the TopicNum

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'DoAutoMergeEmail'

/other/forum2/post_info.asp, line 1269

Guessing this means its not a valid value then?<
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 11 January 2007 :  18:22:56  Show Profile  Reply with Quote
Post the Response.Write that you used.<

Support Snitz Forums
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07