############################################### ## Mod Title: Birthday PART 1 ## Mod Version: 1.3.15. ## Author: Niels Chr. Denmark < ncr@db9.dk > (Niels Chr. Rød) HTTP://mods.db9.dk ## ## This mod is for phpBB2!! ver 2.0.2 ## ## Description: This mod will add a birthday field into your users' profile. ## and make users age vieweble to others, when viewing posts ## Users who not specify a birthday, the script will default to "None Specified." # ## At the day of the users birthday (or on next visit) the board ## can be configured to display a birthday greeting ## when users changing there profile they automatically, enable greeting on there new birthhday ## the admin configuration part of the mod will follow in a PART 2. ## ## ## Installation Level: advanced ## Installation Time: 20-40 Minutes ## Files To Edit: 13 ## includes/usercp_register.php ## includes/usercp_viewprofile.php ## includes/usercp_avatar.php ## viewtopic.php ## includes/page_header.php ## index.php ## includes/functions.php ## language/lang_english/lang_main.php ## templates/subsilver/index_body.tpl ## templates/subsilver/overall_header.tpl ## templates/subsilver/profile_view_body.tpl ## templates/subsilver/profile_add_body.tpl ## templates/subsilver/viewtopic_body.tpl ## Included Files: 2 ## birthday_popup.php ## templates/subsilver/greeting_popup.tpl ## ## History: ## 0.9.0. - initial BETA release phpBB2 RC-2 ## 1.0.0. - initial release ## 1.1.0. - initial relese phpBB2 ver 2.0.0. ## 1.1.8. - history started, improved page_header.php ## 1.1.9. - fix a missing tag in profile_add_body.tpl ## 1.1.10. - minor change the lang_main.php, $lang['Birthday_explain'] to properly support different birthday formats ## 1.1.11. - the english language file, have now changed a few places thanks to "mr Cru" ## 1.1.12. - speed improvements, I have moved some of the code from page_header.php to index.php, it turn out that none was using the info on other pages, so no need for them there ## 1.1.13. - fixed a wrong [FIND] after the speed improvements ## 1.1.14. - fixed a mistake in index.php, that causes no users to have birthday ## 1.2.0. - now confirmed for phpBB2 version 2.0.2 ## 1.2.1. - have missed to include some changes in the how-to, regarding viewtopic.php ## 1.2.2. - $year changed to $birth_year, to avoid complications together with other mods ## 1.3.0. - Now support drop down box as input for birthday in users profile ## 1.3.1. - fix a bug in index.php ## 1.3.2. - included the file birthday_popup.php, now changes to privmsg.php are not nessesary ## 1.3.3. - corrected some typo's related to user_register.php introduced in ver 1.3.0 ## 1.3.4. - calculation of dates now correct on 31-12 if leap year and date > 1970 ## 1.3.5. - there was a typo in the how-to regarding page_header.php ## 1.3.6. - improved drop down, thanks to "weaselweb" ## 1.3.7. - code in ver 1.3.6. improved ## 1.3.8. - code in functions.php improved ## 1.3.9. - fix, age calculation around year shift ## 1.3.10 - missed some language updates for ver 1.3.9 ## 1.3.11 - usernames on index sepperated by commas ## 1.3.12 - if no users in list a "array" was showen, this is now corrected ## 1.3.13 - fix, date of 1. was showen as last day in previous month ## 1.3.14 - a $$ is changed to a $ in index.php ## 1.3.15 - users birthday was "reset" if other errors occour in usercp_register.php ## ## ############################################################## ## This MOD is released under the GPL License. ## Intellectual Property is retained by the MOD Author(s) listed above ############################################################## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ ############################################################## ## Authors Notes: ## ## if you are using a prefix to you DB tabels then you have to add this to ## the SQL commands, e.g. "phpbb_users" instead of just "users" - ONLY ## in the initial SQL commands, not in the php code ! ## if in doubt run the included db_update.php file instead of the initial [ADD SQL] commands ## ## This mod support to different types of template layout ## either the birthday may be enter as regular text, or use a drop down box ## ################################################################# ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ## and the Database ################################################################# # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE users ADD user_birthday INT DEFAULT '999999' # #-----[ ADD SQL ]------------------------------------------ # ALTER TABLE users ADD user_next_birthday_greeting INT DEFAULT '0' # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('birthday_greeting', '1') # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('max_user_age', '100') # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('min_user_age', '5') # #-----[ ADD SQL ]------------------------------------------ # INSERT INTO config (config_name, config_value) VALUES ('birthday_check_day', '7') #################################################################### # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every language your board uses). language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # # AT THE BOTTOM OF THE PAGE // // That's all Folks! # #-----[ BEFORE, ADD ]------------------------------------------ # //Add on for Birthday Mod $lang['Birthday'] = 'Birthday'; $lang['No_birthday_specify'] = 'None Specified'; $lang['Age'] = 'Age'; $lang['Birthday_explain'] = 'The syntax used is %s, e.g. %s, remember prefixed zeros'; $lang['Wrong_birthday_format'] = 'The birthday format was entered incorrectly.'; $lang['Submit_date_format'] = 'd-m-Y'; //php date() format - Note: ONLY d, m and Y may be used and SHALL ALL be used (different seperators are accepted) $lang['Birthday_greeting_today'] ='We would like to wish you congratulatons on reaching %s years old today.

The Management';//%s is substituted with the users age $lang['Birthday_greeting_prev'] ='We would like to give you a belated congratulatons for becoming %s years old on the %s.

The Management';//%s is substituted with the users age, and birthday $lang['Greeting_Messaging'] ='Congratulations'; $lang ['Birthday_today'] = 'Users with a birthday today:'; $lang ['Birthday_week'] = 'Users with a birthday within the next %d days:'; $lang ['Nobirthday_week'] = 'No users are having a birthday in the upcoming %d days'; // %d is substitude with the number of days $lang ['Nobirthday_today']='No users have a birthday today'; $lang['Year'] = 'Year'; $lang['Month'] = 'Month'; $lang['Day'] = 'Day'; $lang['day_short'] = array ($lang['datetime']['Sun'],$lang['datetime']['Mon'],$lang['datetime']['Tue'],$lang['datetime']['Wed'],$lang['datetime']['Thu'],$lang['datetime']['Fri'],$lang['datetime']['Sat']); $lang['day_long'] = array ($lang['datetime']['Sunday'],$lang['datetime']['Monday'],$lang['datetime']['Tuesday'],$lang['datetime']['Wednesday'],$lang['datetime']['Thursday'],$lang['datetime']['Friday'],$lang['datetime']['Saturday']); $lang['month_short'] = array ($lang['datetime']['Jan'],$lang['datetime']['Feb'],$lang['datetime']['Mar'],$lang['datetime']['Apr'],$lang['datetime']['May'],$lang['datetime']['Jun'],$lang['datetime']['Jul'],$lang['datetime']['Aug'],$lang['datetime']['Sep'],$lang['datetime']['Oct'],$lang['datetime']['Nov'],$lang['datetime']['Dec']); $lang['month_long'] = array ($lang['datetime']['January'],$lang['datetime']['February'],$lang['datetime']['March'],$lang['datetime']['April'],$lang['datetime']['May'],$lang['datetime']['June'],$lang['datetime']['July'],$lang['datetime']['August'],$lang['datetime']['September'],$lang['datetime']['October'],$lang['datetime']['November'],$lang['datetime']['December']); # #-----[ OPEN ]------------------------------------------ # includes/usercp_register.php # #-----[ FIND ]------------------------------------------ # $strip_var_list = array( # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE, BEFORE ADD ]------------------------------------------ # , 'birthday' => 'birthday' # #-----[ FIND ]------------------------------------------ # $signature = str_replace('
', "\n", $signature); # #-----[ AFTER, ADD ]------------------------------------------ # $b_day = ( isset($HTTP_POST_VARS['b_day']) ) ? intval ($HTTP_POST_VARS['b_day']) : 0; $b_md = ( isset($HTTP_POST_VARS['b_md']) ) ? intval ($HTTP_POST_VARS['b_md']) : 0; $b_year = ( isset($HTTP_POST_VARS['b_year']) ) ? intval ($HTTP_POST_VARS['b_year']) : 0; # #-----[ FIND ]------------------------------------------ # $interests = stripslashes($interests); # #-----[ AFTER, ADD ]------------------------------------------ # $birthday = stripslashes($birthday); # #-----[ FIND ]------------------------------------------ # if ( !$error ) { if ( $avatar_sql == '' ) # #-----[ BEFORE, ADD ]------------------------------------------ # // find the birthday values, reflected by the $lang['Submit_date_format'] if ($b_day || $b_md || $b_year) //if a birthday is submited, then validate it { $user_age=(date('md')>=$b_md.$b_day) ? date('Y') - $b_year : date('Y') - $b_year - 1 ; // Check date, mximum / minimum user age if (!checkdate($b_md,$b_day,$b_year)|| $user_age>$board_config['max_user_age'] ||$user_age<$board_config['min_user_age']) { $error = TRUE; if( isset($error_msg) )$error_msg .= "
"; $error_msg .= $lang['Wrong_birthday_format']; } else { $birthday = ($error) ? $birthday : mkrealdate($b_day,$b_md,$b_year); $next_birthday_greeting = (date('md')<$b_md.$b_day) ? date('Y'):date('Y')+1 ; } } else if ($birthday || !$board_config['min_user_age']) //if a birthday is submited, then validate it { for ($i=0;$i<=strlen($lang['Submit_date_format']);$i++) { switch ($lang['Submit_date_format'][$i]) { case d: $day=$birthday_lengt;$date_count++; $birthday_lengt++;break; case m: $md=$birthday_lengt;$date_count++; $birthday_lengt++;break; case Y: $year=$birthday_lengt;$date_count++; $birthday_lengt=$birthday_lengt+3;break; } $birthday_lengt++; } // did we find both day,month and year if ($date_count<3) { $error = TRUE; if( isset($error_msg) )$error_msg .= "
"; $error_msg .= $lang['Wrong_birthday_format']; } else { $day=$birthday[$day].$birthday[$day+1]; $md=$birthday[$md].$birthday[$md+1]; $year=$birthday[$year].$birthday[$year+1].$birthday[$year+2].$birthday[$year+3]; $user_age=(date('md')>=$md.$day) ? date('Y') - $year : date('Y') - $year - 1 ; // Check date, mximum / minimum user age if (!checkdate($md,$day,$year) || $user_age<$board_config['min_user_age'] || $user_age>$board_config['max_user_age']) { $error = TRUE; if( isset($error_msg) )$error_msg .= "
"; $error_msg .= $lang['Wrong_birthday_format']; } else { $birthday = ($error) ? $birthday : mkrealdate($day,$md,$year); $next_birthday_greeting = (date('md')<$md.$day) ? date('Y'):date('Y')+1 ; } } } else $birthday = ($error) ? '' : 999999; # #-----[ FIND ]------------------------------------------ # $sql = "UPDATE " . USERS_TABLE . " SET # #-----[ IN-LINE FIND ]------------------------------------------ # $avatar_sql . " # #-----[ IN-LINE, AFTER ADD ]------------------------------------------ # , user_birthday='$birthday', user_next_birthday_greeting='$next_birthday_greeting' # #-----[ FIND ]------------------------------------------ # $sql = "INSERT INTO " . USERS_TABLE . " ( VALUES ( # #-----[ IN-LINE FIND ]------------------------------------------ # , user_allow_pm # #-----[ IN-LINE AFTER,ADD ]------------------------------------------ # ,user_birthday, user_next_birthday_greeting # #-----[ IN-LINE FIND ]------------------------------------------ # ,"; # #-----[ IN-LINE BEFORE,ADD ]------------------------------------------ # ,'$birthday','$next_birthday_greeting' # #-----[ FIND ]------------------------------------------ # $interests = htmlspecialchars(stripslashes($interests)); # #-----[ AFTER, ADD ]------------------------------------------ # $birthday = htmlspecialchars(stripslashes($birthday)); # #-----[ FIND ]------------------------------------------ # $interests = htmlspecialchars($userdata['user_interests']); # #-----[ AFTER, ADD ]------------------------------------------ # $birthday = ($userdata['user_birthday']!=999999) ? realdate($lang['Submit_date_format'],$userdata['user_birthday']):''; $b_day = ($userdata['user_birthday']!=999999) ? realdate('j',$userdata['user_birthday']):''; $b_md = ($userdata['user_birthday']!=999999) ? realdate('n',$userdata['user_birthday']):''; $b_year = ($userdata['user_birthday']!=999999) ? realdate('Y',$userdata['user_birthday']):''; # #-----[ FIND ]------------------------------------------ # display_avatar_gallery( # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE ADD ]------------------------------------------ # , $birthday # #-----[ FIND ]------------------------------------------ # if ( $mode == 'editprofile' ) { $template->assign_block_vars('switch_edit_profile', array()); } # #-----[ BEFORE, ADD ]------------------------------------------ # $s_b_day = $lang['Day'].'   '; $s_b_day= str_replace("value=\"".$b_day."\">", "value=\"".$b_day."\" SELECTED>" ,$s_b_day); $s_b_md = $lang['Month'].'   '; $s_b_md = str_replace("value=\"".$b_md."\">", "value=\"".$b_md."\" SELECTED>" ,$s_b_md); $s_b_year = $lang['Year'].'    '; $i=0; $s_birthday=''; for ($i=0;$i<=strlen($lang['Submit_date_format']);$i++) { switch ($lang['Submit_date_format'][$i]) { case d: $s_birthday .=$s_b_day;break; case m: $s_birthday .=$s_b_md;break; case Y: $s_birthday .=$s_b_year;break; } } # #-----[ FIND ]------------------------------------------ # $template->assign_vars(array( 'USERNAME' => $username, 'CUR_PASSWORD' => $cur_password, 'NEW_PASSWORD' => $new_password, 'PASSWORD_CONFIRM' => $password_confirm, 'EMAIL' => $email, 'YIM' => $yim, 'ICQ' => $icq, 'MSN' => $msn, 'AIM' => $aim, 'OCCUPATION' => $occupation, 'INTERESTS' => $interests, # #-----[ AFTER, ADD ]------------------------------------------ # 'BIRTHDAY' => $birthday, 'S_BIRTHDAY' => $s_birthday, # #-----[ FIND ]------------------------------------------ # 'L_INTERESTS' => $lang['Interests'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_BIRTHDAY' => $lang['Birthday'], 'L_BIRTHDAY_EXPLAIN' =>sprintf($lang['Birthday_explain'],$lang['Submit_date_format'],date($lang['Submit_date_format'])), # #-----[ OPEN ]------------------------------------------ # includes/usercp_viewprofile.php # #-----[ FIND ]------------------------------------------ # 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ', # #-----[ AFTER, ADD ]------------------------------------------ # 'BIRTHDAY' => ($profiledata['user_birthday']!=999999) ? $poster_birthday=realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']) : $poster_birthday=$lang['No_birthday_specify'], # #-----[ FIND ]------------------------------------------ # 'L_INTERESTS' => $lang['Interests'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_BIRTHDAY' => $lang['Birthday'], # #-----[ OPEN ]------------------------------------------ # includes/usercp_avatar.php # #-----[ FIND ]------------------------------------------ # function display_avatar_gallery( # #-----[ IN-LINE FIND ]------------------------------------------ # ) # #-----[ IN-LINE BEFORE ADD ]------------------------------------------ # , &$birthday # #-----[ FIND ]------------------------------------------ # $params = array( # #-----[ IN-LINE FIND ]------------------------------------------ # ); # #-----[ IN-LINE BEFORE ADD ]------------------------------------------ # , 'birthday' # #-----[ OPEN ]------------------------------------------ # includes/functions.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # // Add function mkrealdate for Birthday MOD // the originate php "mktime()", does not work proberly on all OS, especially when going back in time // before year 1970 (year 0), this function "mkrealtime()", has a mutch larger valid date range, // from 1901 - 2099. it returns a "like" UNIX timestamp divided by 86400, so // calculation from the originate php date and mktime is easy. // mkrealdate, returns the number of day (with sign) from 1.1.1970. function mkrealdate($day,$month,$birth_year) { // range check months if ($month<1 || $month>12) return "error"; // range check days switch ($month) { case 1: if ($day>31) return "error";break; case 2: if ($day>29) return "error"; $epoch=$epoch+31;break; case 3: if ($day>31) return "error"; $epoch=$epoch+59;break; case 4: if ($day>30) return "error" ; $epoch=$epoch+90;break; case 5: if ($day>31) return "error"; $epoch=$epoch+120;break; case 6: if ($day>30) return "error"; $epoch=$epoch+151;break; case 7: if ($day>31) return "error"; $epoch=$epoch+181;break; case 8: if ($day>31) return "error"; $epoch=$epoch+212;break; case 9: if ($day>30) return "error"; $epoch=$epoch+243;break; case 10: if ($day>31) return "error"; $epoch=$epoch+273;break; case 11: if ($day>30) return "error"; $epoch=$epoch+304;break; case 12: if ($day>31) return "error"; $epoch=$epoch+334;break; } $epoch=$epoch+$day; $epoch_Y=sqrt(($birth_year-1970)*($birth_year-1970)); $leapyear=round((($epoch_Y+2) / 4)-.5); if (($epoch_Y+2)%4==0) {// curent year is leapyear $leapyear--; if ($birth_year >1970 && $month>=3) $epoch=$epoch+1; if ($birth_year <1970 && $month<3) $epoch=$epoch-1; } else if ($month==2 && $day>28) return "error";//only 28 days in feb. //year if ($birth_year>1970) $epoch=$epoch+$epoch_Y*365-1+$leapyear; else $epoch=$epoch-$epoch_Y*365-1-$leapyear; return $epoch; } // Add function realdate for Birthday MOD // the originate php "date()", does not work proberly on all OS, especially when going back in time // before year 1970 (year 0), this function "realdate()", has a mutch larger valid date range, // from 1901 - 2099. it returns a "like" UNIX date format (only date, related letters may be used, due to the fact that // the given date value should already be divided by 86400 - leaving no time information left) // a input like a UNIX timestamp divided by 86400 is expected, so // calculation from the originate php date and mktime is easy. // e.g. realdate ("m d Y", 3) returns the string "1 3 1970" // UNIX users should replace this function with the below code, since this should be faster // //function realdate($date_syntax="Ymd",$date=0) //{ return create_date($date_syntax,$date*86400,$board_config['board_timezone']); } function realdate($date_syntax="Ymd",$date=0) { global $lang; $i=2; if ($date>=0) { $year=date%1461; $days = $date - $year*1461; while ($days > 364) { $year++; $days-=365; if ($i++==3) { $i=0; $days--; } } if (days<=0 && $i==0) { $days++; } } else { $year= -(date%1461); $days = $date + $year*1461; while ($days<0) { $year--; $days+=365; if ($i++==3) { $i=0; $days++; } } } $leap_year = ($i==0) ? TRUE : FALSE; $months_array = ($i==0) ? array (0,31,60,91,121,152,182,213,244,274,305,335,366) : array (0,31,59,90,120,151,181,212,243,273,304,334,365) ; for ($month=1;$month<12;$month++) { if ($days<$months_array[$month]) break; } $day=$days-$months_array[$month-1]+1; //you may gain speed performance by remove som of the below entry's if they are not needed/used return strtr ($date_syntax, array( 'a' => '', 'A' => '', '\\d' => 'd', 'd' => ($day>9) ? $day : '0'.$day, '\\D' => 'D', 'D' => $lang['day_short'][($date-3)%7], '\\F' => 'F', 'F' => $lang['month_long'][$month-1], 'g' => '', 'G' => '', 'H' => '', 'h' => '', 'i' => '', 'I' => '', '\\j' => 'j', 'j' => $day, '\\l' => 'l', 'l' => $lang['day_long'][($date-3)%7], '\\L' => 'L', 'L' => $leap_year, '\\m' => 'm', 'm' => ($month>9) ? $month : '0'.$month, '\\M' => 'M', 'M' => $lang['month_short'][$month-1], '\\n' => 'n', 'n' => $month, 'O' => '', 's' => '', 'S' => '', '\\t' => 't', 't' => $months_array[$month]-$months_array[$month-1], 'w' => '', '\\y' => 'y', 'y' => ($year>29) ? $year-30 : $year+70, '\\Y' => 'Y', 'Y' => $year+1970, '\\z' => 'z', 'z' => $days, '\\' => '', 'W' => '') ); } # #-----[ OPEN ]------------------------------------------ # viewtopic.php # #-----[ FIND ]------------------------------------------ # $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid # #-----[ IN LINE FIND]------------------------------------------ # u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, # #-----[ REPLACE WITH ]------------------------------------------ # u.* , # #-----[ FIND ]------------------------------------------ # for($i = 0; $i < $total_posts; $i++) # #-----[ BEFORE, ADD ]------------------------------------------ # $this_year=create_date('Y', time(), $board_config['board_timezone']); $this_date = create_date('md', time(), $board_config['board_timezone']); # #-----[ FIND ]------------------------------------------ # $poster_id = $postrow[$i]['user_id']; $poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $postrow[$i]['username']; # #-----[ AFTER, ADD ]------------------------------------------ # if ( $postrow[$i]['user_birthday'] != 999999 ) { $poster_age = $this_year - realdate ('Y',$postrow[$i]['user_birthday']); if ($this_date $poster, # #-----[ AFTER, ADD ]------------------------------------------ # 'POSTER_AGE' => $poster_age, # #-----[ OPEN ]------------------------------------------ # includes/page_header.php # #-----[ FIND ]------------------------------------------ # // // Obtain number of new private messages // if user is logged in // if( $userdata['session_logged_in'] ) { # #-----[ AFTER, ADD ]------------------------------------------ # // see if user has or have had birthday, also see if greeting are enabled if ( $userdata['user_birthday']!=999999 && $board_config['birthday_greeting'] ) { if ( ( create_date('Ymd', time(), $board_config['default_timezone']) ) >= $userdata['user_next_birthday_greeting'].realdate ('md',$userdata['user_birthday'] ) ) { $sql = "UPDATE " . USERS_TABLE . " SET user_next_birthday_greeting = " . (create_date('Y', time(), $board_config['board_timezone'])+1) . " WHERE user_id = " . $userdata['user_id']; if( !$status = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Could not update next_birthday_greeting for user.", "", __LINE__, __FILE__, $sql); } if (isset($status)) $db->sql_freeresult($status); $greeting_flag=1; } else $greeting_flag=0;//Sorry user shall not have a greeting this year } else $greeting_flag=0;//Sorry user shall not have a greeting this year # #-----[ FIND ]------------------------------------------ # 'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new, # #-----[ AFTER, ADD ]------------------------------------------ # 'GREETING_FLAG' => $greeting_flag, # #-----[ FIND ]------------------------------------------ # 'U_PRIVATEMSGS_POPUP' => append_sid('privmsg.'.$phpEx.'?mode=newpm'), # #-----[ AFTER, ADD ]------------------------------------------ # 'U_GREETING_POPUP' => append_sid('birthday_popup.'.$phpEx), # #-----[ FIND ]------------------------------------------ # if ( !empty($userdata['user_popup_pm']) ) { $template->assign_block_vars('switch_enable_pm_popup', array()); } # #-----[ AFTER, ADD ]------------------------------------------ # if( date('Y') == $userdata['user_next_birthday_greeting']) $template->assign_block_vars('switch_enable_greeting_popup', array()); # #-----[ OPEN ]------------------------------------------ # index.php # #-----[ FIND ]------------------------------------------ # // // Start output of page # #-----[ BEFORE, ADD ]------------------------------------------ # // Birthday Mod, Show users with birthday $sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username" :""; if($result = $db->sql_query($sql)) { if (!empty($result)) { $time_now = time(); $this_year = create_date('Y', $time_now, $board_config['board_timezone']); $date_today = create_date('Ymd', $time_now, $board_config['board_timezone']); $date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']); while ($birthdayrow = $db->sql_fetchrow($result)) { $user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] )); if ( $user_birthday2 < $date_today ) $user_birthday2 += 1000; if ( $user_birthday2 > $date_today && $user_birthday2 <= $date_forward ) { // user are having birthday within the next days $user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']); switch ($birthdayrow['user_level']) { case ADMIN : $birthdayrow['username'] = '' . $birthdayrow['username'] . ''; $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; break; case MOD : $birthdayrow['username'] = '' . $birthdayrow['username'] . ''; $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; break; default: $style_color = ''; } $birthday_week_list .= ' ' . $birthdayrow['username'] . ' ('.$user_age.'),'; } else if ( $user_birthday2 == $date_today ) { //user have birthday today $user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] ); switch ($birthdayrow['user_level']) { case ADMIN : $birthdayrow['username'] = '' . $birthdayrow['username'] . ''; $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; break; case MOD : $birthdayrow['username'] = '' . $birthdayrow['username'] . ''; $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; break; default: $style_color = ''; } $birthday_today_list .= ' ' . $birthdayrow['username'] . ' ('.$user_age.'),'; } } if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' '; if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' '; } $db->sql_freeresult($result); } # #-----[ FIND ]------------------------------------------ # 'L_FORUM' => $lang['Forum'], # #-----[ BEFORE, ADD ]------------------------------------------ # 'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day']>1) ? sprintf((($birthday_week_list)? $lang ['Birthday_week'].$birthday_week_list:$lang ['Nobirthday_week']),$board_config['birthday_check_day']) : '', 'L_WHOSBIRTHDAY_TODAY' =>($board_config['birthday_check_day']) ?($birthday_today_list)? $lang ['Birthday_today'].$birthday_today_list:$lang ['Nobirthday_today'] : '', # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme you use). templates/Subsilver/profile_view_body.tpl # #-----[ FIND ]------------------------------------------ # {L_INTERESTS}: {INTERESTS} # #-----[ AFTER, ADD ]------------------------------------------ # {L_BIRTHDAY}: {BIRTHDAY} # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme you use). templates/subsilver/profile_add_body.tpl # #-----[ FIND ]------------------------------------------ # {L_INTERESTS}: # #-----[ AFTER, ADD ]------------------------------------------ # ## ATTENTION ! ## If you would like a text box instead of a drop down, this mod still support this, use this code in the template ## This way you can deside per template design, how it should look, both are suported # # {L_BIRTHDAY}:
{L_BIRTHDAY_EXPLAIN}
# # # {L_BIRTHDAY}: {S_BIRTHDAY} # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme you use). templates/Subsilver/viewtopic_body.tpl # #-----[ FIND ]------------------------------------------ # {postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}

# #-----[ AFTER, ADD ]------------------------------------------ # {postrow.POSTER_AGE}
# #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme you use). templates/Subsilver/overall_header.tpl # #-----[ FIND ]------------------------------------------ # # #-----[ AFTER, ADD ]------------------------------------------ # # #-----[ OPEN ]------------------------------------------ # # (make sure to edit this file for every theme you use). templates/Subsilver/index_body.tpl # #-----[ FIND ]------------------------------------------ # # #-----[ IN-LINE FIND ]------------------------------------------ # # This value can be different, if other mods, add 1 to the value 2 # #-----[ IN-LINE REPLACE WITH ]------------------------------------------ # 3 # #-----[ FIND ]------------------------------------------ # {LOGGED_IN_USER_LIST} # #-----[ AFTER, ADD ]------------------------------------------ # {L_WHOSBIRTHDAY_TODAY}
{L_WHOSBIRTHDAY_WEEK}
# #-----[ COPY ]------------------------------------------ # copy greeting_popup.tpl.tpl to templates/Subsilver/greeting_popup.tpl # #-----[ COPY ]------------------------------------------ # copy birthday_popup.php to birthday_popup.php # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # #EoM