Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Mail Author for Merge Topic Mod

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
JJenson Posted - 10 January 2007 : 14:17:08
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
15   L A T E S T    R E P L I E S    (Newest First)
JJenson Posted - 11 January 2007 : 19:14:40
This is what it is Davio.

Response.Write (TopicNum)
Response.End<
Davio Posted - 11 January 2007 : 18:22:56
Post the Response.Write that you used.<
JJenson Posted - 11 January 2007 : 17:55:04
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?<
JJenson Posted - 11 January 2007 : 17:47:22
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.<
HuwR Posted - 11 January 2007 : 17:43:50
check that you are hetting a valid value for TopicNum<
JJenson Posted - 11 January 2007 : 17:32:12
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.

<
JJenson Posted - 11 January 2007 : 17:20:11
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.<
Davio Posted - 11 January 2007 : 17:16:23
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
<
JJenson Posted - 11 January 2007 : 16:14:46
Ok will give it a shot a little later today and let you know what happens.

Thanks Huw<
HuwR Posted - 11 January 2007 : 15:48:29
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<
JJenson Posted - 11 January 2007 : 15:29:25
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?<
HuwR Posted - 11 January 2007 : 15:15:44
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<
JJenson Posted - 11 January 2007 : 14:10:01
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.
<
JJenson Posted - 11 January 2007 : 13:53:17
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.<
HuwR Posted - 11 January 2007 : 13:14:21
what is actually going wrong ?<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000 Version 3.4.07