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)
 Birthday Greetings On Log-in
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

richfed
Average Member

United States
999 Posts

Posted - 19 July 2008 :  09:09:39  Show Profile  Visit richfed's Homepage  Reply with Quote
A while back, I noticed that on my birthday, when I visited this site, there was a "Happy Birthday" message to me up by the log-in area of the forum header.

Does anyone have the code to add this to my forum? It was pretty neat!<

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 19 July 2008 :  15:41:23  Show Profile  Reply with Quote
You could embed this routine wherever you want the HB to show:


	if strAgeDOB > "" then
		strSql="SELECT M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE M_NAME='" & strDBNTUserName & "'"
		set rsHB=my_Conn.Execute(strSql)
		Member_DOB=rsHB("M_DOB")
		rsHB.Close
		set rsHB=Nothing
		TDay=DoubleNum(Month(Date())) & DoubleNum(Day(Date()))
		if mid(Member_DOB, 5, 4) = TDay then
			Response.Write	"	<tr>" & vbNewLine & _
				"		<td align=""right"">Happy Birthday!</td>" & vbNewLine & _
				"	</tr>" & vbNewLine
		end if
	end if
<
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 19 July 2008 :  20:43:30  Show Profile  Reply with Quote
This is how it's implemented here:

First add the following to inc_func_common.asp:

function isbday
	if strAgeDOB = "1" and MemberID > 0 then
		set rsbday = my_Conn.Execute ("SELECT M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID & " AND M_DOB <> ''")

		if rsbday.EOF then
			isbday = "no"
		else
			if day(StrToDate(rsbday("M_DOB") & "000000")) = day(strForumTimeAdjust) and month(StrToDate(rsbday("M_DOB") & "000000")) = month(strForumTimeAdjust) then
				isbday = "yes"
			else
				isbday = "no"
			end if
		end if
		set rsbday = nothing
	else
		isbday = "no"
	end if
end function


function getGreeting()
	if isbday = "yes" then
		Response.Write "Happy Birthday!"
	else
		Response.Write "You are logged on as"
	end if
end function


Then in inc_header.asp around line #392 find:

"                <td align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>You are logged on as<br />"

and replace with:
"                <td align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>"
call getGreeting()
Response.Write  "<br />" & vbNewLine
<
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 19 July 2008 :  21:16:00  Show Profile  Visit leatherlips's Homepage  Reply with Quote
That's nice! I didn't know it did that. I've never input my birthday before. I just added it to my site. <

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 19 July 2008 :  21:35:59  Show Profile  Visit leatherlips's Homepage  Reply with Quote
You can also add a little graphic before the birthday such as a birthday cake. I have the events calendar mod installed so I just used it.

I changed this line:
Response.Write "Happy Birthday!"

To this:
Response.Write "" & getCurrentIcon(strCalIconBDay,"Happy Birthday!","vAlign=""middle""") & " <b>Happy Birthday!</b>"
<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD

Edited by - leatherlips on 19 July 2008 21:36:16
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 19 July 2008 :  21:50:53  Show Profile  Reply with Quote
quote:
Originally posted by RichardKinser

This is how it's implemented here ....


Richard, there's no call to "isbday" function that way. Since nothing else uses the functions, couldn't you combine them (as below) & call isbday instead?

function isbday
	if strAgeDOB = "1" and MemberID > 0 then
		set rsbday = my_Conn.Execute ("SELECT M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID & " AND M_DOB <> ''")
		if rsbday.EOF then
			isbday = "no"
		else
			if day(StrToDate(rsbday("M_DOB") & "000000")) = day(strForumTimeAdjust) and month(StrToDate(rsbday("M_DOB") & "000000")) = month(strForumTimeAdjust) then
				isbday = "yes"
			else
				isbday = "no"
			end if
		end if
		set rsbday = nothing
	else
		isbday = "no"
	end if
	if isbday = "yes" then
		Response.Write "Happy Birthday!"
	else
		Response.Write "You are logged on as"
	end if
end function
<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 20 July 2008 :  02:44:54  Show Profile  Visit HuwR's Homepage  Reply with Quote
yes you could, but if you wanted to use it in the future you would then have to re-extract the isbdy function, so I owuld leave it as 2 functions, makes no difference in terms of execution and makes it more flexible.<
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 20 July 2008 :  03:23:49  Show Profile  Reply with Quote
OK - then in our "inc_header.asp", we'd have to call isbday just before calling getGreeting().<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 20 July 2008 :  03:36:22  Show Profile  Visit HuwR's Homepage  Reply with Quote
no, but you need to change this line in callgreeting
if isbday = "yes" then

to be
if isbday() = "yes" then<
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 20 July 2008 :  04:05:16  Show Profile  Reply with Quote
I knew something didn't look right about that function, mind playing tricks on me again.

Tx HuwR<
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 20 July 2008 :  08:20:23  Show Profile  Visit richfed's Homepage  Reply with Quote
Thank you, Lads!<
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 21 July 2008 :  09:12:01  Show Profile  Visit leatherlips's Homepage  Reply with Quote
I added the code that RichardKinser posted and it is working fine. I tried to add what HuwR said in red:

if isbday() = "yes" then

but that caused it not to work any longer. I removed the () and it is working fine. Do I really need to have the ()?<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

balexandre
Junior Member

Denmark
418 Posts

Posted - 22 July 2008 :  03:29:56  Show Profile  Visit balexandre's Homepage  Send balexandre an ICQ Message  Reply with Quote
just as a reminder...

the idea is ok, but:

on your birthday you can be "out" of the PC and the message should be something like...

for the day: "We didn't forgot about you... Happy birthday!", and then never show the message again

for the day after and until the user log in and ... not more than 2/3 weeks: "Hey, hey... we hope that you got a pleasant birth day", and then never show the message again for that year


just my opinion
<

Bruno Alexandre
(Strøby, DANMARK)

"a Portuguese in Danmark"


Go to Top of Page
  Previous Topic Topic Next Topic  
 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.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07