############################################### 
##   Hack Title:   Happy Anniversary Hack 
##   Hack Version:   1.0.2
##   Author:      Triumvirate Studios 
##   Description:   Adds an anniversary message to all users who have been at your site for "X" years on the day they joined. 
##   Compatibility:   2.0.10 (tested) 
## 
##   Installation Level: Easy 
##   Installation Time: 5 minutes 
##   Files To Edit: 2 
##	index.php
##	templates/subSilver/index_body.tpl
## 
##   Included Files: 0 
## 
##   History: 
##      None 
## 
##   Author Notes: 
##      None 
## 
##   Support:      http://www.phpbbhacks.com/forums or http://www.tshacks.net/forums
##   Copyright:      2004 Happy Anniversary Hack 1.0.2 - Triumvirate Studios 
## 
############################################### 
##   You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads. 
##   Please visit http://www.phpbbhacks.com/forums for support. 
############################################### 
## 
############################################### 
##   This hack is released under the GPL License. 
##   This hack can be freely used, but not distributed, without permission. 
##   Intellectual Property is retained by the hack author(s) listed above. 
############################################### 

# 
#-----[ OPEN ]------------------------------------------ 
# 
index.php
# 
#-----[ FIND ]------------------------------------------ 
# 
	//
	// Obtain list of moderators of each forum
	// First users, then groups ... broken into two queries
	//
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
/*START Happy Anniversary Hack.*/
$today_month_day = date('m/d');
$today_year = date('y');
$query = "SELECT user_regdate, user_id FROM phpbb_users WHERE user_id != -1";
if (!($result = $db->sql_query($query)) )
{
  message_die(GENERAL_ERROR, 'Unable to retrieve data', '', __LINE__, __FILE__, $query);
}
while ($r = $db->sql_query($result))
{
$regdate = $r['user_regdate'];
$regdate_month_day = date('m/d', $regdate);
$regdate_year = date('y', $regdate);
}
if ($db->sql_numrows($result) == 0)
{
$sql = "SELECT username, user_id FROM phpbb_users WHERE user_id != -1 && '$today_month_day' = '$regdate_month_day'";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Unable to retrieve data', '', __LINE__, __FILE__, $sql);
}
while($row = $db->sql_fetchrow($result))
{
$username = $row['username'];
$difference_years = $today_year - $regdate_year;

if($difference_years != 0)
{
$template->assign_vars(array(
'L_HAPPY_ANNIVERSARY' => $lang['Happy_Anniversary'])
);
$template->assign_block_vars('joined_date', array(
'USERNAME' => '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $username . '</a>',
'YEARS' => $difference_years)
);
}
}
}
else
{
   $template->assign_vars(array(
'L_HAPPY_ANNIVERSARY' => $lang['No_Happy_Anniversary'])
);
}
/*END Happy Anniversary Hack*/
# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/index_body.tpl
# 
#-----[ FIND ]------------------------------------------ 
# 
#	<td align="left" valign="bottom"><span class="gensmall">
#	<!-- BEGIN switch_user_logged_in -->
#	{LAST_VISIT_DATE}<br />
#	<!-- END switch_user_logged_in -->
#	{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
{L_INDEX}
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<td align="center" valign="bottom"><span class="gensmall">
{L_HAPPY_ANNIVERSARY}
<!-- BEGIN joined_date -->
{joined_date.USERNAME}  ({joined_date.YEARS}),&nbsp;
<!-- END joined_date -->
</span>
</td>
# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php
# 
#-----[ FIND ]------------------------------------------ 
# 
//
// That's all, Folks!
// -------------------------------------------------
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
//
// Happy Anniversary Hack
//
$lang['Happy_Anniversary'] = 'Happy Anniversary to the following members:';
$lang['No_Happy_Anniversary'] = 'No Members have an Anniversary Today';
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
