Congratulating a user that is having a birthday

Started by Compuart, October 08, 2005, 07:55:25 AM

Previous topic - Next topic

SekondeR

is this can be a module?
so that we can change the message easily  etc... ?

ArkServer

Step 3. Use the $context value to tweak the template

for instance:
Code (search: index.template.php) Select
echo '
', $txt['hello_member'], ' <b>', $context['user']['name'], '</b>';


Code (replace) Select
if ($context['user']['today_is_birthday'])
echo '
CONGRATULATIONS <b>', $context['user']['name'], '</b>, have a <img src="', $settings['images_url'], '/bdaycake.gif" width="40" alt="" />';
else
echo '
', $txt['hello_member'], ' <b>', $context['user']['name'], '</b>';





im not sure how to do this in 1.1 rc2

sonic


geezmo

Hopefully someone can show the codes we need to make this work in 1.1RC2 or better, make a mod from this one.

husmen73 (Gulhin)

-Kurumsal Kimlik Web Tasarım Hizmeti.
Gülhin Portal Sistemi hakkında yorumlarınızı bekliyorum.
SMF
Referanslar --> http://www.gulhin.com/referanslar-portfoy/
-Web Tasarımı ve Tema Tasarımı Sitesi www.gulhin.com
-TOPLU MAİL GÖNDERİMİ --> http://www.toplumailsms.com
E-Ticaret Sistemi yaptırmak mı istiyorsunuz?

TechnoDragon

Here is the code snippet...it also includes the good morning, afternoon, evening code as well.

        if ($context['user']['is_logged'])
        {
if ($context['user']['today_is_birthday'])
echo '<span class="normaltext">

<SCRIPT LANGUAGE="JavaScript">

<!--Begin

datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("Good " + display + "!");
document.write(greeting);

//  End -->

</script>

<br>Happy Birthday! <br> <b>', $context['user']['name'], '</b>, <br>have a piece of cake!<br><img src="', $settings['images_url'], '/bdaycake.gif" width="40" alt="" />';
else
echo '<span class="normaltext">
<SCRIPT LANGUAGE="JavaScript">

<!--Begin

datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("Good " + display + "!");
document.write(greeting);

//  End -->

</script> <br> <b>', $context['user']['name'], '</b></span>';


it should replace what is below this:
        // If the user is logged in, display stuff like their name, new messages, etc.


Sorry cannot remember what the original code was...but should go in the index template...i know that line exists in tinyportal...i'll look around and see if i can find where the original unedited code is...
Don't tell me to get into shape...I have a shape...It is round!


PrizeLive.com

Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

TechnoDragon

It changes the standard "Hey [username]" to either Good morning, good afternoon, good evening, [username] as well as when it is the members birthday it changes the greeting on that day only to Happy Birthday [username], have a piece of cake, with an image of a piece of cake.
Don't tell me to get into shape...I have a shape...It is round!


geezmo

Does this code change the welcome greeting to a happy birthday greeting once the member is logged in or does it send a PM or email when it's a person's birthday? I want to have a code that sends an email or PM when it's a member's birthday.

TechnoDragon

You might be able (or someone sles) to accomplish that, but as it is written it only changes the greeting
Don't tell me to get into shape...I have a shape...It is round!


StarBuG

Thanks, this is a realy great Idea.

Implemented it in rc2 with a little tweaking.

Workes perfect

StarBuG
Elternfragen.net - Das Forum für Eltern (SMF)
Fragen und Antworten rund um das Thema Kinder, Entwicklung, Ernährung und Gesundheit unserer Kleinen.
-------------
Patientenfragen.net - Das Forum von Patienten für Patienten
Fragen und Antworten rund um das Thema Krankheit und Gesundheit.
-------------
Hiphop-Battles.com - Version 2
The new standard in online hip hop battles

Loverboy


codenaught

Quote from: LocoTurk on September 16, 2006, 10:18:46 AM
Does this work with RC3?
Almost, the one change for RC3 with use of the new default theme (Core) or themes styled after it, is for the file Themes/default/index.template.php you have to look for:

if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
</td>';


and change it to:

if ($context['user']['today_is_birthday'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;">CONGRATULATIONS <b>', $context['user']['name'], '</b>, have a <img src="', $settings['images_url'], '/bdaycake.gif" width="40" alt="" /></span>
</td>';
else if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
</td>';


The changes for Load.php are the same.
Dev Consultant
Former SMF Doc Coordinator

Loverboy

Isn't there any modification that makes us able to send an automatic email to the user when it's his birthday?

xcrazyxfrogx

Quote from: akabugeyes on September 22, 2006, 07:28:54 PM
Quote from: LocoTurk on September 16, 2006, 10:18:46 AM
Does this work with RC3?
Almost, the one change for RC3 with use of the new default theme (Core) or themes styled after it, is for the file Themes/default/index.template.php you have to look for:

if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
</td>';


and change it to:

if ($context['user']['today_is_birthday'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;">CONGRATULATIONS <b>', $context['user']['name'], '</b>, have a <img src="', $settings['images_url'], '/bdaycake.gif" width="40" alt="" /></span>
</td>';
else if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
</td>';


The changes for Load.php are the same.
not working on index of site the hello thing also got removed and nothing no cake image or somthing


Money... my obsession... Wealth... my addiction... Fear... my weapon... Crazy people... don't you understand... from the smokes of fear... who I am?

digit

I would like to display a slice of cake below users avatars on the Display.template.php page.

so, I tried this...


echo '
', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' &nbsp; <img src="' . $settings['images_url'] . '/bdaycake.gif" width="40" alt="" />' : ''), '';



It didn't work.  Can someone please help me get this snippet working?

Thanks in advance.

Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

guilliam

@digit,

you have two single qoutation mark on your echo.

- g
----
SMF ported on Joomla:
http://www.jcip-zugbuana.org

rzx

Quote from: LocoTurk on September 23, 2006, 11:46:10 PM
Isn't there any modification that makes us able to send an automatic email to the user when it's his birthday?

Something like this would be nice.

GC

Does it not do that already? My site had sent me an e-mail on my birthday.

cmcmom

What I do is just do a NEWS item... make it bold and a large font.....it looks good....no code needed!

Advertisement: