vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Automatic Birthday Thread (https://vborg.vbsupport.ru/showthread.php?t=62613)

ChurchMedia 03-17-2004 10:00 PM

Automatic Birthday Thread
 
This hack is inspired by the Birthday Hack for vB2 by Logician. It will automatically create a Happy Birthday thread in a specified forum, listing the people with birthdays for that day. Then other members can post their happy birthday wishes in the thread.

I had the original hack installed on my VB2 board and when I upgraded to VB3 my members missed it. Luckily, it's really easy to implement.

--------------------------------------
Files to modify: /includes/cron/birthday.php
--------------------------------------

Instructions are in the attached text file. The mod should take about 5 minutes.

Be sure to change the variables that say // CHANGE ME

You can customize the message in the $birthday_greeting_thread variable. You could also ad IMG tags with an image of some kind, like in my screenshot.

Note that you MUST turn on BB CODE in you birthday forum in order for this to work properly.
--------------------------------------
Enjoy (and thanks for the inspiration, Logician!)
--------------------------------------

New in Version 2.0:

Bug fixes:
> More accurate age calculation. Sometimes it was a year off.
> The correct thread shows up in the last thread post on the forum home page.
> HTML is not required to be turned on in the birthday forum.
> Most of the code is completely rewritten to vB3 standards.

New features:
> Improved look
> Birthday line now says: (User) was born on (date), (AGE: xx)
> If the year is not given, it says "Not telling! :)" for age.
> The admin is emailed a list of the birthdays with links to their profiles and a link to the happy birthday thread.
> If you use the uShop/uCash hack, you can give birthday points to the users

Upgrading:

Since the code has changed so drastically, I suggest starting with a fresh copy of birthday.php and following the instructions for a new install.

Vile 03-17-2004 11:27 PM

Very cool idea :)

coldpride 03-17-2004 11:43 PM

Yes almost like the old vb2 hack :) Very very good :)

Vb-Hispano 03-18-2004 12:01 AM

no working :(

Happy Birthday Email


Parse error: parse error in /home/httpd/vhosts/dominio.com/httpdocs/foros/includes/cron/birthday.php on line 59

All Done


in line 59 is this $birthday_greeting_thread = <<< EOF

total php birthday

Code:

<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.0.0 Release Candidate 4 - Licence Number 81xxxxxx
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2004 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

error_reporting(E_ALL & ~E_NOTICE);

if ($DB_site == NULL)
{
        exit;
}

$today = date('m-d', TIMENOW);

$ids = '0';
foreach($usergroupcache AS $usergroupid => $usergroup)
{
        if ($usergroup['genericoptions'] & SHOWBIRTHDAY)
        {
                $ids .= ",$usergroupid";
        }
}

$birthdays = $DB_site->query("
    SELECT username, email, languageid, birthday, userid
    FROM " . TABLE_PREFIX . "user
    WHERE birthday LIKE '$today-%' AND
    (options & $_USEROPTIONS[adminemail]) AND
    usergroupid IN ($ids)
");

vbmail_start();

while ($userinfo = $DB_site->fetch_array($birthdays))
{
        $username = unhtmlspecialchars($userinfo['username']);
        eval(fetch_email_phrases('birthday', $userinfo['languageid']));
        vbmail($userinfo['email'], $subject, $message);
        $emails .= iif($emails, ', ');
        $emails .= $userinfo['username'];
        $bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n";
}

vbmail_end();

if ($emails)
{
        log_cron_action('Birthday Email sent to: ' . $emails, $nextitem);

        // Create Birthday Thread Hack

$birthday_greeting_thread = <<< EOF
Felicidades amigos,

que tengais un gran dia de cumplea?os, que os regalen muchas cosas y
        que sea el dia mas feliz de vuestra vida!

        https://vborg.vbsupport.ru/external/2004/03/1.gif

Que os lo paseis bien y recordar que este foro esta con vosotros...

$bday_people
EOF;

$greeter=11290; //Your User ID
$greeter_name="Administrador"; //Your User Name
$greetings_forum=148; //enter the forum id that you want the thread to go into
$todays_date11= date("F j, Y", mktime (date("H")+$timeset, date("i"), date("s"), date("m"), date("d"), date("Y")));
$title3= "Feliz Cumplea?os a Todos los miembros que cumplen a?os el ";
$title3.=$todays_date11;
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastpos  ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();
// Creating Post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignatu  re,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($birthday_greeting_thread)."','1','0','127.0.0.1','0','1')");
// End Create Birthday Thread Hack


        }

/*======================================================================*\
|| ####################################################################
|| # Downloaded: 05:43, Sun Feb 8th 2004
|| # CVS: $RCSfile: birthday.php,v $ - $Revision: 1.24 $
|| ####################################################################
\*======================================================================*/
?>


Osterling 03-18-2004 12:06 AM

niiiiiiiiiiice hack.. i will def. install this sometime this week and for Vb-Hispano, this hack is for v3, your profile says you use v2

Vb-Hispano 03-18-2004 12:08 AM

I use v 3.0

Rushty 03-18-2004 06:58 AM

Is it possible to specify only specific users groups that it selects birthdays from, and if not any possibility of the option in a future version?

DaveLogic 03-18-2004 10:05 AM

Quote:

Originally Posted by Vb-Hispano
no working :(

Happy Birthday Email


Parse error: parse error in /home/httpd/vhosts/dominio.com/httpdocs/foros/includes/cron/birthday.php on line 59

All Done


in line 59 is this $birthday_greeting_thread = <<< EOF

total php birthday

Code:

<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.0.0 Release Candidate 4 - Licence Number 81xxxxxx
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2004 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

error_reporting(E_ALL & ~E_NOTICE);

if ($DB_site == NULL)
{
        exit;
}

$today = date('m-d', TIMENOW);

$ids = '0';
foreach($usergroupcache AS $usergroupid => $usergroup)
{
        if ($usergroup['genericoptions'] & SHOWBIRTHDAY)
        {
                $ids .= ",$usergroupid";
        }
}

$birthdays = $DB_site->query("
    SELECT username, email, languageid, birthday, userid
    FROM " . TABLE_PREFIX . "user
    WHERE birthday LIKE '$today-%' AND
    (options & $_USEROPTIONS[adminemail]) AND
    usergroupid IN ($ids)
");

vbmail_start();

while ($userinfo = $DB_site->fetch_array($birthdays))
{
        $username = unhtmlspecialchars($userinfo['username']);
        eval(fetch_email_phrases('birthday', $userinfo['languageid']));
        vbmail($userinfo['email'], $subject, $message);
        $emails .= iif($emails, ', ');
        $emails .= $userinfo['username'];
        $bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n";
}

vbmail_end();

if ($emails)
{
        log_cron_action('Birthday Email sent to: ' . $emails, $nextitem);

        // Create Birthday Thread Hack

$birthday_greeting_thread = <<< EOF
Felicidades amigos,

que tengais un gran dia de cumplea?os, que os regalen muchas cosas y
        que sea el dia mas feliz de vuestra vida!

        http://www.dominio.com/foros/images/cumpleanos.gif

Que os lo paseis bien y recordar que este foro esta con vosotros...

$bday_people
EOF;

$greeter=11290; //Your User ID
$greeter_name="Administrador"; //Your User Name
$greetings_forum=148; //enter the forum id that you want the thread to go into
$todays_date11= date("F j, Y", mktime (date("H")+$timeset, date("i"), date("s"), date("m"), date("d"), date("Y")));
$title3= "Feliz Cumplea?os a Todos los miembros que cumplen a?os el ";
$title3.=$todays_date11;
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastpos  ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();
// Creating Post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignatu  re,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($birthday_greeting_thread)."','1','0','127.0.0.1','0','1')");
// End Create Birthday Thread Hack


        }

/*======================================================================*\
|| ####################################################################
|| # Downloaded: 05:43, Sun Feb 8th 2004
|| # CVS: $RCSfile: birthday.php,v $ - $Revision: 1.24 $
|| ####################################################################
\*======================================================================*/
?>













I get the same error as well...Forced to uninstall...

alkatraz 03-18-2004 11:36 AM

Cool hack, thx for the vb3 update

gmarik 03-18-2004 01:43 PM

This is cool. Could you add a .txt file as well?

[email protected] vbmenu_register("postmenu_486546", true); 03-18-2004 03:32 PM

I've done the following modifications and it works fine now. Enhanced the title a little too.

--------------------------------------
UNDER
PHP Code:

$emails .= $userinfo['username']; 


ADD
PHP Code:

$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n"
$bday_title .= $username.", "

--------------------------------------
UNDER
PHP Code:

log_cron_action('Birthday Email sent to: ' $emails$nextitem); 


ADD
PHP Code:

// Create Birthday Thread Hack 
$birthday_greeting_thread "Here are today's birthdays!<br><br>$bday_people"

$greeter=11064//Your User ID
$greeter_name="Happy Birthday"//Your User Name
$greetings_forum=6//enter the forum id that you want the thread to go into
$todays_date11date("F j, Y"mktime (date("H")+$timesetdate("i"), date("s"), date("m"), date("d"), date("Y")));
$title3"Happy Birthday to ";
$title3.= $bday_title;
$title3.= "on ";
$title3.=$todays_date11;
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastposter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();
// Creating Post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($birthday_greeting_thread)."','1','0','127.0.0.1','0','1')");
// End Create Birthday Thread Hack 


sabret00the 03-18-2004 03:37 PM

not bad, although if you could get it to make individual threads it would be even better

Vb-Hispano 03-18-2004 03:43 PM

Quote:

Originally Posted by MK@spug.net
I've done the following modifications and it works fine now. Enhanced the title a little too.

--------------------------------------
UNDER
PHP Code:

$emails .= $userinfo['username']; 


ADD
PHP Code:

$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n"
$bday_title .= $username.", "

--------------------------------------
UNDER
PHP Code:

log_cron_action('Birthday Email sent to: ' $emails$nextitem); 


ADD
PHP Code:

// Create Birthday Thread Hack 
$birthday_greeting_thread "Here are today's birthdays!<br><br>$bday_people"

$greeter=11064//Your User ID
$greeter_name="Happy Birthday"//Your User Name
$greetings_forum=6//enter the forum id that you want the thread to go into
$todays_date11date("F j, Y"mktime (date("H")+$timesetdate("i"), date("s"), date("m"), date("d"), date("Y")));
$title3"Happy Birthday to ";
$title3.= $bday_title;
$title3.= "on ";
$title3.=$todays_date11;
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastposter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();
// Creating Post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($birthday_greeting_thread)."','1','0','127.0.0.1','0','1')");
// End Create Birthday Thread Hack 



Not Working

There seems to have been a slight problem with the Foros xxxxxxxxx database.
Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.


:( :disappointed:

Memnoch-NMX- 03-18-2004 05:21 PM

Quote:

Originally Posted by Rushty
Is it possible to specify only specific users groups that it selects birthdays from, and if not any possibility of the option in a future version?

I'd like to see this option as well. I have a news script that generats news on the main page of my site based on a specific forum id. We only post birthday news for Admins and Super Mods of the forum. All other birthday announcements go in my Gen Chat forum.

M.C. 03-18-2004 05:22 PM

i`d love to see instructions file attached to first post ;)

ChurchMedia 03-19-2004 01:38 AM

For those of you having errors, there were some spaces added to the queries when I pasted the code (??). I've attached instructions in a text format. Copy from there and it should work.

MK@spug.net: Nice addition

sabret00the: To create individual threads for each birthday, just move the step 3 code up underneath the $bday_people = .... line. It should work, but I haven't tried it.

As far as usergroups, I'm still getting the hang of VB3. :)

Enjoy,

M.C. 03-19-2004 01:50 AM

thanx a lot man! ;)

Floris 03-19-2004 04:41 AM

Quote:

Originally Posted by ChurchMedia
This hack is based on the Birthday Hack by Logician and includes some of the original code. It will automatically create a Happy Birthday thread in a specified forum, listing the people with birthdays for that day. Then other members can post their happy birthday wishes in the thread.

I had the original hack installed on my VB2 board and when I upgraded to VB3 my members missed it. Luckily, it's really easy to implement.

--------------------------------------
Files to modify: /includes/cron/birthday.php
--------------------------------------

Instructions are in the attached text file. The mod should take about 5 minutes.

Change the variables for the userid, username and forumid.

You can customize the message in between the <<< EOF and EOF; tags. You could also ad IMG tags with an image of some kind, like in my screenshot.
--------------------------------------
Let me know if anyone has any ideas on how to improve this. I'd like to see:
1) The age calculated and shown
2) The birthday shown in this format: March 17, 1970
3) A link to the thread in their birthday email

Enjoy (and thanks for the inspiration and some code, Logician!)

Members pick up quite quickly that the thread is automated, and on a busy board you also end up with a forum full of the same topics.

I rather have a cron file that run once per month to insert a new thread for the birthdays of that month. This way members can congratulate and others have time to participate.

ChurchMedia 03-19-2004 04:48 AM

Actually, the topics change every day... e.g. "Happy Birthday to our members on DATE", etc. And with MK@spug.net's version it changes even more: "Happy Birthday to user, user, user on date". I set aside a sub-forum just for birthdays so it stacks up there. :)

Quote:

Originally Posted by floris
Members pick up quite quickly that the thread is automated, and on a busy board you also end up with a forum full of the same topics.

I rather have a cron file that run once per month to insert a new thread for the birthdays of that month. This way members can congratulate and others have time to participate.


ryancooper 03-20-2004 12:25 PM

Just curious, how are you testing this? I see some people saying they are getting errors? Wouldn;t it run behind the scenes via cron?

ChurchMedia 03-20-2004 05:24 PM

In your admin cp under scheduled tasks, you can choose to "run now" for any cron job. It's really useful for testing.

FASherman 03-20-2004 06:46 PM

Quote:

Originally Posted by ChurchMedia
For those of you having parse errors, there were some spaces added to the queries when I pasted the code (??). I've attached instructions in a text format. Copy from there and it should work.

MK@spug.net: Nice addition

sabret00the: To create individual threads for each birthday, just move the step 3 code up underneath the $bday_people = .... line. It should work, but I haven't tried it.

As far as usergroups, I'm still getting the hang of VB3. :)

Enjoy,

The parsing errors have nothing to do with queries, but with this line:

$birthday_greeting_thread = <<< EOF

It is bad syntax. Its also bad coding form.

ChurchMedia 03-21-2004 01:40 AM

hmmm.... I see that method used all the time. It doesn't cause errors even if it's considered bad syntax. What would you suggest (aside from calling a vb template)? :ermm:

ChurchMedia 03-21-2004 02:23 AM

I did go ahead and change the $birthday_greeting_thread into a single line variable instead of using <<< EOF EOF; tags, but that format is used quite frequently. I'm not sure why it would cause an error. PhotoPost makes liberal use of this type of format and it's taught in PHP books.... ??? :ermm:

nhochochack 03-21-2004 08:04 AM

use it for vbb Gold ,, don't work ,

Ted S 03-21-2004 09:21 AM

Great hack! I've got too many birthdays to print all the names in the title but I'm using the rest of MK@spug.net's changes. Very easy install on vb3 gold (if you're having errors check to see if your mysql insert has extra spaces).

Vb-Hispano 03-21-2004 03:17 PM

yes, working in gold

thanks :D

Platinumgamer 03-21-2004 03:26 PM

Hmm...this hack works fine on Gold, however the thread doesn't show up on the forumhome, just inside the forum. Also, the thread count doesn't rise when new threads are made. (I just installed this hack, so it only has one thread posted...yet the forum for the BDay threads still has '0' as the thread count...even though the reply count is there.

Is this supposed to happen, and can it be fixed?

Thanks!

ChurchMedia 03-21-2004 06:57 PM

Good point. I left out a couple of line of code from Logician's original hack. Add these lines right above // End Create Birthday Thread Hack

PHP Code:

// Updating Forum
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastposter='".addslashes($greeter_name)."' WHERE forumid = $greetings_forum");
// Updating User's Post
$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter"); 

I just tested it and it works. Credit goes to Logician :). I updated the original txt file.

Quote:

Originally Posted by Platinumgamer
Hmm...this hack works fine on Gold, however the thread doesn't show up on the forumhome, just inside the forum. Also, the thread count doesn't rise when new threads are made. (I just installed this hack, so it only has one thread posted...yet the forum for the BDay threads still has '0' as the thread count...even though the reply count is there.

Is this supposed to happen, and can it be fixed?

Thanks!


Platinumgamer 03-21-2004 08:07 PM

Thanks ChurchMedia and Logician!

That worked perfectly. :)

jluerken 03-22-2004 07:01 AM

HTML Code:

$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastpos    ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();
// Creating Post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignatu    re,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($birthday_greeting_thread)."','1','0','127.0.0.1','0','1')");
// End Create Birthday Thread Hack

BE careful with these line if you're using table prefixes

then you have to change this:
HTML Code:

INSERT INTO thread to INSERT INTO yourprefix_thread
and this
HTML Code:

INSERT INTO post to INSERT INTO yourprefix_post
Maybe the author of this hack can change these lines to reflect installations which are using table prefixes :D

ChurchMedia 03-22-2004 07:13 AM

Quote:

Originally Posted by jluerken
Maybe the author of this hack can change these lines to reflect installations which are using table prefixes :D

Great idea! I added " . TABLE_PREFIX . " in the appropriate places. Thanks for the heads up.

:)

ryancooper 03-22-2004 12:35 PM

Strange, i ran the Happy Birthday email and got no errors but I had a birthday and gor a email :

Database error in vBulletin 3.0.0 Release Candidate 4:

Invalid SQL: INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastpos ter,dateline,iconid,visible,attach) VALUES (NULL,'Happy Birthday to on March 21, 2004','1079867961','6','1','0','Happy Birthday','11064','Happy Birthday','1079867961','0','1','0')
mysql error: 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 'ter,dateline,iconid,visible,attach) VALUES (NULL,'Happy Birthda

mysql error number: 1064

Any ideas what is wrong??

Thanks!

ChurchMedia 03-22-2004 02:34 PM

Be sure to change the user id,user name and forum id variables. If they don't exist you will get an error. Looks like you might have used example variables (from MK@spug.net). Let me know if you still have problems after changing these:

$greeter=1; //Your User ID
$greeter_name="Your User Name"; //Your User Name
$greetings_forum=1; //enter the forum id that you want the thread to go into

ryancooper 03-22-2004 06:13 PM

Quote:

Originally Posted by ChurchMedia
Be sure to change the user id,user name and forum id variables. If they don't exist you will get an error. Looks like you might have used example variables (from MK@spug.net). Let me know if you still have problems after changing these:

$greeter=1; //Your User ID
$greeter_name="Your User Name"; //Your User Name
$greetings_forum=1; //enter the forum id that you want the thread to go into


AAHHh YEs I didn;t read that closely enough. . . :nervous: Thanks for the reply!

ryan\

egyptsons 03-23-2004 07:51 PM

Quote:

Originally Posted by Vile
Very cool idea :)

;) nice work man

EvilLS1 04-25-2004 10:25 PM

To show the age (in years)...

In includes/cron/birthday.php find:
Code:

        $emails .= iif($emails, ', ');
        $emails .= $userinfo['username'];

Below it add:
Code:

// Generate Age
               
                        if (!$year)
                        {
                                $year = vbdate('Y', TIMENOW, false, false);
                                $month = vbdate('n', TIMENOW, false, false);
                                $day = vbdate('j', TIMENOW, false, false);
                        }
                        if (empty($gotage["$userinfo[userid]"]))
                        {
                                $date = explode('-', $userinfo['birthday']);
                                if ($year > $date[2] AND $date[2] != '0000')
                                {
                                        $age = $year - $date[2];
                                        if ($month < $date[0] OR ($month == $date[0] AND $day < $date[1]))
                                        {
                                                $age--;
                                        }
                                        if ($age < 101)
                                        {
                                                $gotage["$userinfo[userid]"] = $age;
                                        }
                                        else
                                        {
                                                unset($age);
                                        }
                                }
                        }
                        else
                        {
                                $age = $gotage["$age[userid]"];
                        }
               
// end age

Find:
Code:

$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n";
Replace it with:
Code:

$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, Age: ".$age."\n";

ChurchMedia 04-25-2004 11:06 PM

Very cool! Thanks for that addition. Here's an addition to email the greeter when the thread is created (it will email the birthday greeting).


Find:
Code:

$greeter=1; //His User ID
The number (1) may be different.

Below that add:
Code:

$greetermail="youremail@yourdomain.com";
Change the email address to your own.

Find:
Code:

$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter");
Below that add:
Code:

// email the admin
$birthday_greeting_thread=strip_tags($birthday_greeting_thread);
vbmail_start();
vbmail($greetermail, $title3, $birthday_greeting_thread);
vbmail_end();


ChurchMedia 04-25-2004 11:18 PM

Here's an addition to give users store points for their birthday:

Find:
Code:

$bday_title .= $username.", ";
Below that add:
Code:

$DB_site->query("UPDATE user SET storep=storep+50 where userid='$userinfo[userid]'");
Be sure to change "storep" to the correct field for the store hack you are using. For the new uShop hack, look in your AdminCP to find out what to use there.

You can change the "50" to however many points you want to give for a birthday present. Be sure to mention the present in your birthday greeting. :)

lasto 04-25-2004 11:40 PM

church media one request if possible - can this be set to ignore zero posters ?


All times are GMT. The time now is 04:46 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01615 seconds
  • Memory Usage 1,958KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (12)bbcode_code_printable
  • (3)bbcode_html_printable
  • (9)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete