## ## Mod title: Birthday Mod ## ## Mod version: 1.0 ## Works on PunBB: 1.2.* ## Release date: 2008-04-25 ## Author: Koos (pampoen10@yahoo.com) ## ## Description: Allows users to enter their birthdays in their profile. ## The current day's birthdays will then be displayed in ## the board stats on the forum's main page. ## ## Affected files: index.php ## profile.php ## style/imports/base.css ## ## Affects DB: New column in 'users' table: ## 'birthday' ## ## Notes: Ignore steps 1-18 if you've got the Calendar mod installed ## ## DISCLAIMER: Please note that "mods" are not officially supported by ## PunBB. Installation of this modification is done at your ## own risk. Backup your forum database and any and all ## applicable files before proceeding. ## ## # #---------[ 1. UPLOAD ]------------------------------------------------- # Upload all files and folders contained in archive to forum root. Keep folder structure intact. # #---------[ 2. RUN ]---------------------------------------------------------- # install_mod.php # #---------[ 3. DELETE ]------------------------------------------------------- # install_mod.php # #---------[ 4. OPEN ]--------------------------------------------------------- # profile.php # #---------[ 5. FIND (line: 27) ]--------------------------------------------- # require PUN_ROOT.'include/common.php'; # #---------[ 6. AFTER, ADD ]--------------------------------------------------- # require PUN_ROOT.'lang/'.$pun_user['language'].'/birthday.php'; # #---------[ 7. FIND (line: 852) ]--------------------------------------------- # $temp[] = $key.'='.$value; } # #---------[ 8. AFTER, ADD ]--------------------------------------------------- # // Setting birthday var for update -- made by Gizzmo(justgiz@justgizzmo.com) if(isset($_POST['bday_year'])&& isset($_POST['bday_month']) && isset($_POST['bday_day'])) $birthday = $_POST['bday_year']."-".$_POST['bday_month']."-".$_POST['bday_day']; $bday_query = (isset($birthday)) ? 'birthday="'.$birthday.'", ': NULL; # #---------[ 9. FIND (line: 865) ]--------------------------------------------- # $db->query('UPDATE '.$db->prefix.'users SET '.implode(',', $temp).' WHERE id='.$id) or error('Unable to update profile', __FILE__, __LINE__, $db->error()); # #---------[ 10. REPLACE WITH ]------------------------------------------------- # $db->query('UPDATE '.$db->prefix.'users SET '.$bday_query.implode(',', $temp).' WHERE id='.$id) or error('Unable to update profile', __FILE__, __LINE__, $db->error()); # #---------[ 11. FIND (line: 904) ]--------------------------------------------- # $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); # #---------[ 12. REPLACE WITH ]------------------------------------------------- # $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.birthday, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); # #---------[ 13. FIND (line: 963) ]--------------------------------------------- # $posts_field = ''; # #---------[ 14. BEFORE, ADD ]--------------------------------------------------- # list($year, $month, $day) = explode('-',$user['birthday']); if($month!=0 && $day!=0){ $Nyear = (strlen($year)!=4)? NULL: $year; $datestamp = mktime(0,0,0,$month,$day,0); if ($lang_birthday['Date_format'] == 'US') { $birthday = date("F jS ", $datestamp).$Nyear; } else { $birthday = date("j ", $datestamp).$lang_birthday[(date("F", $datestamp))].$Nyear; } }else $birthday = $lang_profile['Unknown']; # #---------[ 15. FIND (line: 1004) ]--------------------------------------------- #
 
# #---------[ 16. AFTER, ADD ]--------------------------------------------------- #
:
 
# #---------[ 17. FIND (line: 1258) ]--------------------------------------------- # # #---------[ 18. AFTER, ADD ]--------------------------------------------------- #
\n"; echo"\t\t\t\t\t\t\t\t\t\n"; echo "\t\t\t\t\t\t\t\t\t
# #---------[ 19. OPEN ]--------------------------------------------------------- # index.php # #---------[ 20. FIND (line: 27) ]--------------------------------------------- # require PUN_ROOT.'include/common.php'; # #---------[ 21. AFTER, ADD ]--------------------------------------------------- # require PUN_ROOT.'lang/'.$pun_user['language'].'/birthday.php'; # #---------[ 22. FIND (line: 192) ]--------------------------------------------- # $num_users = count($users); # #---------[ 23. BEFORE, ADD ]--------------------------------------------------- # //-------Birthday Code Start------- // today's birthdays $ttoday = time(); $tdiff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600; $ttoday += $tdiff; $tyear = date("Y"); $tmonth = date("n"); $tday = date("j", $ttoday); $result = $db->query('SELECT id, username, birthday FROM '.$db->prefix.'users WHERE DAYOFMONTH(birthday) = '.$tday.' AND MONTH(birthday) = '.$tmonth.' ORDER BY username') or error('Unable to fetch birthday list', __FILE__, __LINE__, $db->error()); $bdays_today = array(); while ($pun_bdays_today = $db->fetch_assoc($result)){ $bparts = Explode('-', $pun_bdays_today['birthday']); $bday_year = $bparts[0]; $age = (strlen($bday_year)!='4')? "": "(".($tyear-$bday_year).")"; $bdays_today[] .= "\n\t\t\t\t".'
'.$pun_bdays_today['username'].''.$age; } $num_bdays_today = count($bdays_today); //-------Birthday Code End------- # #---------[ 24. FIND (line: 223) ]--------------------------------------------- # } else echo "\t\t".''."\n\t\t\t".'
'."\n"; # #---------[ 25. BEFORE, ADD ]--------------------------------------------------- # // list today's birthdays if ($num_bdays_today > 0) echo "\t\t\t".'
'."\n\t\t\t\t".'
'.$lang_birthday['Bdays_today'].': 
'."\t\t\t\t".implode(',
', $bdays_today).''."\n\t\t\t".''."\n"; else echo "\t\t\t".'
'."\n"; # #---------[ 26. OPEN ]--------------------------------------------------------- # style/imports/base.css # #---------[ 27. FIND (line: 229) ]--------------------------------------------- # /* 8.1 Horizontal display of online list, main navigation menu and breadcrumbs */ # #---------[ 28. AFTER, ADD ]--------------------------------------------------- # Note: No blank lines after the comma # #bdayslist DD, #bdayslist DT, # #---------[ 29. SAVE/UPLOAD ]------------------------------------------------- #