The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
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!<
Does anyone have the code to add this to my forum? It was pretty neat!<
Postet den
You could embed this routine wherever you want the HB to show:
<
Code:
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
Postet den
This is how it's implemented here:
First add the following to inc_func_common.asp:
Then in inc_header.asp around line #392 find:
and replace with:
<
First add the following to inc_func_common.asp:
Code:
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 functionThen in inc_header.asp around line #392 find:
Code:
" <td align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>You are logged on as<br />"Code:
" <td align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>"
call getGreeting()
Response.Write "<br />" & vbNewLine
Postet den
That's nice! I didn't know it did that. I've never input my birthday before. I just added it to my site.
<
Postet den
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:
To this:
<
I changed this line:
Code:
Response.Write "Happy Birthday!"Code:
Response.Write "" & getCurrentIcon(strCalIconBDay,"Happy Birthday!","vAlign=""middle""") & " <b>Happy Birthday!</b>"
Sist redigert av
Postet den
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?
Code:
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
Postet den
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.<
Postet den
OK - then in our "inc_header.asp", we'd have to call isbday just before calling getGreeting().<
Postet den
no, but you need to change this line in callgreeting
if isbday = "yes" then
to be
if isbday() = "yes" then<
if isbday = "yes" then
to be
if isbday() = "yes" then<
Postet den
I knew something didn't look right about that function, mind playing tricks on me again.
Tx HuwR<
Tx HuwR<
Postet den
Thank you, Lads!<
Email Member
Message Member
Post Moderation
Filopplasting
If you're having problems uploading, try choosing a smaller image.
Forhåndsvis post
Send Topic
Loading...