Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Automatic Birthday Thread Details »»
Automatic Birthday Thread
Version: 1.00, by ChurchMedia ChurchMedia is offline
Developer Last Online: Jun 2013 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 03-17-2004 Last Update: Never Installs: 115
 
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 04-25-2004, 11:58 PM
EvilLS1's Avatar
EvilLS1 EvilLS1 is offline
 
Join Date: Apr 2002
Location: Georgia, USA
Posts: 987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lasto
church media one request if possible - can this be set to ignore zero posters ?
Yep. I added that and a few other options to mine.

In birthday.php find:
Code:
$birthdays = $DB_site->query(" 
    SELECT username, email, languageid, birthday, userid
Replace it with:
Code:
$birthdays = $DB_site->query("
	SELECT username, email, languageid, posts, userid, birthday
Find:
Code:
	$emails .= iif($emails, ', ');
	$emails .= $userinfo['username'];
Below it add:
Code:
$posts = $userinfo[posts];
Find:
Code:
// Create Birthday Thread Hack
Below it add:
Code:
if ($posts>='1')
{
You can change the "1" in the code above to whatever you want the minium posts for birthday threads to be


Find:
Code:
// End Create Birthday Thread Hack
Above it add:
Code:
}
If you also want to limit the birthday threads & emails to users who have visited the site within the time set in your admin panel for showing birthdays on forum home do this:

In birthday.php find:
Code:
$birthdays = $DB_site->query("
Above it add:
Code:
	if ($vboptions['birthdaydatecut'])
	{
		$datecut = TIMENOW - (intval($vboptions['birthdaydatecut']) * 86400);
		$activitycut = "AND lastactivity >= $datecut";
	}
	else
	{
		$activitycut = '';
	}
Find:
Code:
    (options & $_USEROPTIONS[adminemail]) AND 
    usergroupid IN ($ids) 
");
Replace it with:
Code:
	(options & $_USEROPTIONS[adminemail]) AND
	usergroupid IN ($ids) $activitycut
");
Reply With Quote
  #43  
Old 04-26-2004, 01:57 AM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lasto
church media one request if possible - can this be set to ignore zero posters ?
Another way to do that (but not as much control) is to change:

Code:
$birthdays = $DB_site->query("
	SELECT username, email, languageid, birthday, userid
	FROM " . TABLE_PREFIX . "user
	WHERE birthday LIKE '$today-%' AND
	usergroupid IN ($ids)
");
to

Code:
$birthdays = $DB_site->query("
	SELECT username, email, languageid, birthday, userid
	FROM " . TABLE_PREFIX . "user
	WHERE birthday LIKE '$today-%' AND
	usergroupid IN ($ids) AND lastpost !=0
");
That would only select users that have posted. I haven't tested it, but it should work.

EvilLS1's version gives you a lot more options.
Reply With Quote
  #44  
Old 05-07-2004, 03:55 PM
jp2's Avatar
jp2 jp2 is offline
 
Join Date: Sep 2003
Location: UK
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How do you turn it off??? :-S
Reply With Quote
  #45  
Old 05-07-2004, 04:53 PM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Turn off what? The automatic email or the automatic thread?
Reply With Quote
  #46  
Old 05-09-2004, 04:40 PM
jp2's Avatar
jp2 jp2 is offline
 
Join Date: Sep 2003
Location: UK
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The automatic thread.
Reply With Quote
  #47  
Old 05-09-2004, 10:12 PM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure -- just put a \\ in front of all of the lines that relate to thread creation -- or delete everything that you hacked in.
Reply With Quote
  #48  
Old 05-10-2004, 03:15 PM
jp2's Avatar
jp2 jp2 is offline
 
Join Date: Sep 2003
Location: UK
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!
Reply With Quote
  #49  
Old 05-10-2004, 09:21 PM
jons5150 jons5150 is offline
 
Join Date: Jul 2002
Location: Palm Springs, Ca.
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Parse error: parse error in /home/virtual/site1/fst/var/www/html/forums/includes/cron/birthday.php on line 86

<?php
/*================================================= =====================*\
|| ################################################## ################## ||
|| # vBulletin 3.0.1 - Licence Number XXXXXXXXXX
|| # ---------------------------------------------------------------- # ||
|| # 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 (!is_object($DB_site))
{
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";
$bday_title .= $username.", ";


vbmail_end();

if ($emails)
{
log_cron_action('Birthday Email sent to: ' . $emails, $nextitem);
// Create Birthday Thread Hack
$birthday_greeting_thread = "Here are today's birthdays!<br><br>$bday_people";

$greeter=3; //Your User ID
$greeter_name="Jon"; //Your User Name
$greetings_forum=56; //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= "Happy Birthday to ";
$title3.= $bday_title;
$title3.= "on ";
$title3.=$todays_date11;
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastpos ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."', '".time()."','$greetings_forum','1','0','".addslas hes($greeter_name)."','$greeter','".addslashes($gr eeter_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,pa getext,allowsmilie,showsignatu re,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialcha rs($title3))."','".addslashes($greeter_name)."','$ greeter','".time()."','".addslashes($birthday_gree ting_thread)."','1','0','127.0.0.1','0','1')");
// Updating Forum
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($gr eeter_name)."' WHERE forumid = $greetings_forum");
// Updating User's Post
$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter");
// End Create Birthday Thread Hack



/*================================================= =====================*\
|| ################################################## ##################
|| # Downloaded: 22:57, Sun May 2nd 2004
|| # CVS: $RCSfile: birthday.php,v $ - $Revision: 1.25 $
|| ################################################## ##################
\*================================================ ======================*/
?>
Reply With Quote
  #50  
Old 06-03-2004, 08:39 PM
Onkel_Tom's Avatar
Onkel_Tom Onkel_Tom is offline
 
Join Date: Mar 2002
Location: Stuttgart- Germany
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ Jons5150

You missed a } between the two lines
Code:
$bday_title .= $username.", "; 


vbmail_end();
should be:
Code:
$bday_title .= $username.", "; 
}

vbmail_end();
Reply With Quote
  #51  
Old 06-03-2004, 09:57 PM
Onkel_Tom's Avatar
Onkel_Tom Onkel_Tom is offline
 
Join Date: Mar 2002
Location: Stuttgart- Germany
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about Usergroups to exclude from Birthday thread ?
any idea how to do this ?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:30 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05899 seconds
  • Memory Usage 2,329KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (16)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete