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)
 Mod: Site Supporter
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 October 2009 :  17:30:29  Show Profile  Reply with Quote
See this line:
strMessage = strMessage & "' You can extend your sponsorship of '" & strForumTitle & "' at  http://www.maggotdrowning.com/store/index.php?app=gbu0&ns=prodshow&ref=sitesupporter"">The Online Shop</a> '" & vbNewLine


Check the content of the strMessage line when it's output to the screen to make sure it says what you want. BTW, when you're happy with the EMail results, you can remove the lines beginning with:
Response.Write

Edited by - Carefree on 12 October 2009 06:57:01
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 11 October 2009 :  18:44:57  Show Profile  Reply with Quote
You'll need to set a value in the member table to indicate that the EM/PM has been sent or the member will get them with every view of every page.


Site Supporter 2.0
[ALTER]
MEMBERS
ADD#M_SPONSORREMIND#int#NULL#0
[END]



Change this in "inc_header.asp" (it was backwards):
		if SponsorDate >= DatetoStr(DateAdd("d",-30,strForumTimeAdjust)) then



This version includes a check if a reminder message has already been sent.

<%
strSql = "SELECT M_PMRECEIVE, M_SPONSORREMIND FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID="&MEMBERID
set rsPMs=my_Conn.Execute(strSql)
strSponsorRemind = "0"
if not rsPMs.EOF then
	if isnull(rsPMs("M_SPONSORREMIND")) THEN
		strSponsorRemind="0"
	else
		strSponsorRemind = cStr(rsPMs("M_SPONSORREMIND"))
	end if
	strPMReceive = cStr(rsPMs("M_PMRECEIVE"))
	rsPMs.Close
end if
set rsPMs = Nothing
if strSponsorRemind <> "1" then
	if strPMReceive = "1" and strPMStatus = "1" then
		'	PMs allowed, send PM
		set rsAdmin=Nothing
		strSql = "INSERT INTO " & strTablePrefix & "PM (M_SUBJECT, M_FROM, M_TO, M_SENT, M_MESSAGE, M_MAIL, M_READ, M_OUTBOX) VALUES ("
		strSql = strSql & "'" & strForumTitle & " Sponsor Renewal '"
		strSql = strSql & ", " & intAdminMemberID
		strSql = strSql & ", " & MEMBERID
		strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
		strMessage = strMessage & ", 'You have previously chosen to become a forum sponsor.  The sponsorship period "
		if SponsorDate >= DatetoStr(strForumTimeAdjust) then
			strMessage = strMessage & "will expire on: "
		else
			strMessage = strMessage & "expired on: "
		end if
		strMessage = strMessage & StrtoDate(SponsorDate)
		strMessage = strMessage & ". You can extend your sponsorship of " & strForumTitle & " within your profile. '" & vbNewLine & vbNewLine
		strSql = strSql & strMessage 
		strSql = strSql & ", '" & TF & "'"
		strSql = strSql & ", 0, 1)"
		set rsPM=my_Conn.Execute(strSql)
		strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS SET M_SPONSORREMIND=1 WHERE MEMBER_ID="&MEMBERID
		my_Conn.Execute(strSql)
	else
		'	PMs not allowed, send EM
		strRecipientsName = strDBNTUserName
		strSql = "SELECT M_EMAIL FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID="& MEMBERID
		set rsEM=my_Conn.Execute(strSql)
		if not rsEM.EOF then
			strRecipients = chkString(rsEM("M_EMAIL"), "SQLString")
			rsEM.Close
		end if
		set rsEM = Nothing
		strFrom = strSender
		strFromName = strForumTitle
		strSubject = strForumTitle & " Sponsor Renewal "
		strMessage = "Hello " & strDBNTUserName & vbNewLine & vbNewLine
		strMessage = strMessage & "You received this message from " & strForumTitle & ".  You have previously chosen to become a forum sponsor." & vbNewLine & vbNewLine
		strMessage = strMessage & "The sponsorship period  "
		if SponsorDate >= DatetoStr(strForumTimeAdjust) then
			strMessage = strMessage & "will expire on: "
		else
			strMessage = strMessage & "expired on: "
		end if
		strMessage = strMessage & StrtoDate(SponsorDate) & ".  "
		strMessage = strMessage & "You can extend your sponsorship of " & strForumTitle
		strMessage = strMessage & " within your profile at:  " & strForumURL & "pop_profile.asp?mode=Edit" & vbNewLine & vbNewLine
		%>
		<!--#INCLUDE FILE="inc_mail.asp" -->
		<%
		strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS SET M_SPONSORREMIND=1 WHERE MEMBER_ID="&MEMBERID
		my_Conn.Execute(strSql)
	end if
end if
%>


Edited by - Carefree on 12 October 2009 21:06:25
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 12 October 2009 :  17:57:00  Show Profile  Visit Webbo's Homepage  Reply with Quote
Nice work Carefree

One thing to add is that M_PMRECEIVE and M_SPONSORREMIND need adding also to the MEMBERS table:

[ALTER]
MEMBERS
ADD#M_SPONSORRENEW#int#NULL#0
ADD#M_PMRECEIVE#int#NULL#0
ADD#M_SPONSORREMIND#int#NULL#0
[END]

I've yet to test it with Private Messages but the email sending works well

I'll report back shortly
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 12 October 2009 :  18:24:40  Show Profile  Visit Webbo's Homepage  Reply with Quote
Found one problem and that is that once an email is sent out to one member then all member's M_SPONSORREMIND is set to 1, not just the member that was sent the email

I suspect caused by this line:
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS SET M_SPONSORREMIND=1"
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 12 October 2009 :  20:29:01  Show Profile  Reply with Quote
duhhh
yeah, that would cause it

Fixed it and added a check for a null value in code above.

Edited by - Carefree on 12 October 2009 21:07:44
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 12 October 2009 :  20:34:44  Show Profile  Reply with Quote
quote:
Originally posted by Webbo

Nice work Carefree

One thing to add is that M_PMRECEIVE and M_SPONSORREMIND need adding also to the MEMBERS table:



PMRECEIVE is added by the private messages dbs file.
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 13 October 2009 :  17:18:50  Show Profile  Visit Webbo's Homepage  Reply with Quote
I added the above because I didn't have Private Messaging added to my test forum
(I forgot to remove it before posting it above )

Email function works fine now and with a MySql db, however I'm getting the following error for the PM function using MySql:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14' 

[MySQL][ODBC 3.51 Driver][mysqld-5.0.67-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Forum Sponsor Renewal ', 1, 397, '20091013221505', 'You have previously chosen' at line 1 

/forum/inc_sponsor_renew.asp, line 35


Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 14 October 2009 :  16:23:53  Show Profile  Reply with Quote
quote:
's Forum Sponsor Renewal

Apparently you changed the code. I didn't have any apostrophe showing possession.
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 14 October 2009 :  18:55:36  Show Profile  Visit Webbo's Homepage  Reply with Quote
Strange one, it turned out to be an apostrophe in my forum's name that caused the error

Anyway, all tested now on MySql and the emailand PM function work well but the following line in inc_header.asp:

if SponsorDate >= DatetoStr(DateAdd("d",-30,strForumTimeAdjust))


needs changing to this:

if SponsorDate <=  DatetoStr(DateAdd("d",+30,strForumTimeAdjust)) then


otherwise all sponsors with more than 30 days to renewal will receive the reminder

One thing though, if the column M_SPONSORREMIND in the database is set to 1 after the reminder has been sent out, that prevents repeat reminders being sent at each page view, but what will happen in a year's time - would this prevent further reminders being sent out?

Regards,

Dave
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 14 October 2009 :  19:17:14  Show Profile  Reply with Quote
Yes. One solution to that would be to change the field from an integer to a string and use the date a reminder was sent. Alternatively, you could add a routine to set it to 0 upon renewal of the sponsorship.
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 15 October 2009 :  03:00:24  Show Profile  Visit Webbo's Homepage  Reply with Quote
I had a thought last night and the easiest way I think to do this would be to have a checkbox for the administrator to tick to set the member's M_SPONSORREMIND to 0 within inc_profile.asp whilst they are entering the 'Supporter End Date:' which has to be done manually

Added onto this code should do the job:

Response.Write " <tr>" & vbNewLine & _
         "       <td bgColor=""" & strPopUpTableColor& """ align=right valign=""top"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>Supporter End Date:</b>" & vbNewline & _
         "       <br><small>eg: 01/01/2009</small></font></td>" & vbNewLine & _
         "       <td bgColor=""" & strPopUpTableColor & """ valign=""top"">" & vbNewLine
Response.Write " <input name=""SPONSORDATE"" size=""14"" value=""" & rs("M_SPONSORDATE") & """></font>"
vbNewLine


I'll have a look at it tonight (UKtime) unless you beat me to it

Edited by - Webbo on 15 October 2009 03:16:21
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 16 October 2009 :  01:02:52  Show Profile  Reply with Quote
No reason to add an extra step for the administrator. In "pop_profile.asp", look for the following lines (appx 1599-1601 in the file modified for sponsor mod):

					strSql = strSql & " WHERE MEMBER_ID = " & cLng(Request.Form("MEMBER_ID"))

					my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

After those lines, insert the following:

					if DatetoStr(Request.Form("SPONSORDATE")) > DatetoStr(strForumTimeAdjust) then
						strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS SET M_SPONSORREMIND=0 WHERE MEMBER_ID="&MEMBERID
						my_Conn.Execute(strSql)
					end if
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 16 October 2009 :  18:16:51  Show Profile  Visit Webbo's Homepage  Reply with Quote
I couldn't get that to work Carefree, it didn't make any changes to the M_SPONSORREMIND value in the db when the sponsor date was changed to a later date than the forum date

I had a go at adding a checked checkbox to inc_profile and achieved this:


Response.Write " <tr>" & vbNewLine & _
         "       <td bgColor=""" & strPopUpTableColor& """ align=right valign=""top"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>Reset Reminder:</b>" & vbNewline & _
               "    <input type=""checkbox"" name=""SPONSORREMIND"" value=""1"" checked=""true"">" & vbNewLine
Response.Write "            </td>" & vbNewLine & _
               "                    </tr>" & vbNewLine
   if request("SPONSORREMIND") = "1" then
       strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS SET M_SPONSORREMIND=0 WHERE MEMBER_ID="&MEMBERID
                  my_Conn.Execute(strSql)
                  end if


However, I cannot get that to change the value to 0 either when the Submit button is clicked when editing a profile as admin

Any idea whats missing?
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 16 October 2009 :  21:40:31  Show Profile  Reply with Quote
That's odd because it works fine here. Did you make sure to set the sponsorship date at least 31 days in advance (so it didn't automatically reset to 1 again)?
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 28 October 2009 :  16:30:54  Show Profile  Visit Webbo's Homepage  Reply with Quote
Hi Carefree - I'm not ignoring you just been too busy of late and not had chance to get back on with it
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous 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.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07