MOD download & history

Mod that adds a birthday field to the users profile, theire age are displayed beside the posts, and on there birthday they will have a greeting popup
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

MOD download & history

Postby Niels on Wed 10. Apr, 2002 15:20

Code: Select all
##############################################################
## MOD Title:          Birthday
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description:    This mod will add a birthday field into your
##                     user's profile and make users age viewable
##                     to others when viewing posts.
## MOD Version:        1.5.7
## Compatibility:      2.0.6->2.0.8
##
## Installation Level: Advanced
## Installation Time:  30 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      18
##      index.php
##      viewtopic.php
##      admin/admin_board.php
##      admin/admin_users.php
##      includes/functions.php
##      includes/page_header.php
##      includes/usercp_avatar.php
##      includes/usercp_register.php
##      includes/usercp_viewprofile.php
##      language/lang_english/lang_admin.php
##      language/lang_english/lang_main.php
##      templates/subSilver/index_body.tpl
##      templates/subSilver/overall_header.tpl
##      templates/subSilver/profile_add_body.tpl
##      templates/subSilver/profile_view_body.tpl
##   templates/subSilver/viewtopic_body.tpl
##      templates/subSilver/admin/board_config_body.tpl
##      templates/subSilver/admin/user_edit_body.tpl
##     
## Included Files:     3
##      birthday_db_update.php
##   root/birthday_popup.php
##   root/templates/subSilver/greeting_popup.tpl
##
##############################################################

:arrow: To know the languages already available in the MOD archive, please click here

Note: zodiacs images pack for black template & background
-> http://mods.db9.dk/viewtopic.php?p=7263#7263

Note: improve the sped of this MOD by looking at this topic ->
http://mods.db9.dk/viewtopic.php?t=5306
Last edited by Niels on Thu 14. Oct, 2004 22:04, edited 20 times in total.
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Thu 18. Apr, 2002 21:58

PART one is now update to ver 1.1.6, there was a bug, causing that the birthday list on index page was not displayed rigth if a user was not logged in

here are how to correct this, if you have already made this mod

in file peage_header.php
Code: Select all
[FIND]
$year=create_date('Y', time(), $userdata['user_timezone']);

[MOVE THE LINE SO IT IS AFTER THIS LINE]
//
// Obtain number of new private messages
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Fri 19. Apr, 2002 00:28

PART 2 is now updated, new version is 1.1.2
it is now also posible to change how meny days the script shall look forward, to see witch users are having birthday the next X upcomming days

For users already done the mod - here are the how to upgrade to ver 1.1.2

Code: Select all
in file lang_admin.pgp
[FIND]:
$lang['Min_user_age_explain'] = "Setting this value to 0, will force user to enter a birthday";

[ADD AFTER]:
$lang['Birthday_lookforward'] = "Birthday look forward";
$lang['Birthday_lookforward_explain'] = "Number of days the script shall look forward for users with a birthday";

in file admin/admin_board.php

[FIND]:
'L_MIN_USER_AGE_EXPLAIN' => $lang['Min_user_age_explain'],

[ADD AFTER]:
'L_BIRTHDAY_LOOKFORWARD' => $lang['Birthday_lookforward'],
'L_BIRTHDAY_LOOKFORWARD_EXPLAIN' => $lang['Birthday_lookforward_explain'],

[FIND]:
'MIN_USER_AGE' => $new['min_user_age'],

[ADD AFTER]:
'BIRTHDAY_LOOKFORWARD' => $new['birthday_check_day'],


in file template_dirXX/admin/board_config_body.tpl

[FIND]:
   <td class="row2"><input type="text" size="4" maxlength="4" name="min_user_age" value="{MIN_USER_AGE}" /></td>
</tr>

[ADD AFTER]:
<tr>
   <td class="row1">{L_BIRTHDAY_LOOKFORWARD}<br /><span class="gensmall">{L_BIRTHDAY_LOOKFORWARD_EXPLAIN}</span></td>
   <td class="row2"><input type="text" size="3" maxlength="3" name="birthday_check_day" value="{BIRTHDAY_LOOKFORWARD}" /></td>
</tr>
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

UPDATE

Postby Niels on Mon 29. Apr, 2002 05:34

PART 1 is now updated to ver 1.1.7

minor correction, primary speed improvements to index.php, but also minor isues about time zones

here are how to upgrade
in file functions.php
Code: Select all
[FIND]
function realdate($date_syntax,$date="")
[REPLACE WITH]
function realdate($date_syntax,$date)

[DELETE LINE]
if (empty($date)) $date=floor(time()/86400);



in file page_header.php
Code: Select all
[FIND]:
// Birthday Mod, Show users with birthday
$sql = "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username";
if($result = $db->sql_query($sql))
{
$birthdayrow = $db->sql_fetchrowset($result);
if (count($birthdayrow))
{
$date_today = create_date('Ymd', time(), $userdata['user_timezone']);
   $date_forward = create_date('Ymd', time()+($board_config['birthday_check_day']*86400), $userdata['user_timezone']);

      for($i = 0; $i < count($birthdayrow); $i++)
      {
      $user_birthday=realdate("md",$birthdayrow[$i]['user_birthday']);
$user_age=($user_birthday<create_date('md', time(), $userdata['user_timezone']))?$year- realdate ('Y',$birthdayrow[$i]['user_birthday'])+1:$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
      $user_birthday=(($user_birthday<create_date('md', time(), $userdata['user_timezone']))? $year+1:$year).$user_birthday;
      if ($user_birthday==$date_today)
      {
        //user have birthday today
         $style_color = "";
         if( $birthdayrow[$i]['user_level'] == ADMIN )
         {
            $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         }
         else if( $birthdayrow[$i]['user_level'] == MOD )
         {
            $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         }
               $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.($year- realdate ('Y',$birthdayrow[$i]['user_birthday'])).')</b></a>';

         } else
         if ($user_birthday>$date_today  && $user_birthday<=$date_forward)
      {
         // user are having birthday within the next days
         $style_color = "";
         if( $birthdayrow[$i]['user_level'] == ADMIN )
         {
            $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         }
         else if( $birthdayrow[$i]['user_level'] == MOD )
         {
            $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         }
               $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
      }
   }
}
}

[REPLACE WITH]
// Birthday Mod, Show users with birthday
$sql = "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username";
if($result = $db->sql_query($sql))
{
$birthdayrow = $db->sql_fetchrowset($result);
if (!empty($birthdayrow))
{
   $date_today = create_date('Ymd', time(), $board_config['board_timezone']);
   $date_forward = create_date('Ymd', time()+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
      for($i = 0; $i < count($birthdayrow); $i++)
      {
         $user_birthday=realdate("md",$birthdayrow[$i]['user_birthday']);
         $user_birthday2=(($year.$user_birthday<$date_today)? $year+1:$year).$user_birthday;
      if ($user_birthday2==$date_today)
         {
         //user have birthday today
         $user_age=$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
         $style_color = "";
         $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
         if( $birthdayrow[$i]['user_level'] == ADMIN )
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         else if( $birthdayrow[$i]['user_level'] == MOD )
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.($year- realdate ('Y',$birthdayrow[$i]['user_birthday'])).')</b></a>';
         }
      else if ($user_birthday2>$date_today  && $user_birthday2<=$date_forward)
      {
         // user are having birthday within the next days
         $user_age=($year.$user_birthday<$date_today)?$year- realdate ('Y',$birthdayrow[$i]['user_birthday'])+1:$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
         $style_color = "";
         $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
         if( $birthdayrow[$i]['user_level'] == ADMIN )
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         else if( $birthdayrow[$i]['user_level'] == MOD )
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
      }
   }
}
}
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Tue 30. Apr, 2002 21:15

I have once again looked at the code, and further improved it
PART 1 is now 1.1.8.

in file page_header.php
Code: Select all
[FIND]
if ($user_birthday2==$date_today)
         {
         //user have birthday today
         $user_age=$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
         $style_color = "";
         $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
         if( $birthdayrow[$i]['user_level'] == ADMIN )
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         else if( $birthdayrow[$i]['user_level'] == MOD )
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.($year- realdate ('Y',$birthdayrow[$i]['user_birthday'])).')</b></a>';
         }
      else if ($user_birthday2>$date_today  && $user_birthday2<=$date_forward)
      {
         // user are having birthday within the next days
         $user_age=($year.$user_birthday<$date_today)?$year- realdate ('Y',$birthdayrow[$i]['user_birthday'])+1:$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
         $style_color = "";
         $birthdayrow[$i]['username'] = '<b>' . $birthdayrow[$i]['username'] . '</b>';
         if( $birthdayrow[$i]['user_level'] == ADMIN )
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         else if( $birthdayrow[$i]['user_level'] == MOD )
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
}

[RELACE WITH]
if ($user_birthday2==$date_today)
{
   //user have birthday today
   $user_age=$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
   $style_color = "";
   if( $birthdayrow[$i]['user_level'] == ADMIN ) $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
   else if( $birthdayrow[$i]['user_level'] == MOD ) $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
   $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
}
else if ($user_birthday2>$date_today  && $user_birthday2<=$date_forward)
{
   // user are having birthday within the next days
   $user_age=($year.$user_birthday<$date_today)?$year- realdate ('Y',$birthdayrow[$i]['user_birthday'])+1:$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
   $style_color = "";
   if( $birthdayrow[$i]['user_level'] == ADMIN ) $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
   else if( $birthdayrow[$i]['user_level'] == MOD )  $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
   $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
}
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Wed 01. May, 2002 01:19

once again the PART 1 has been updated, new version is 1.1.9.
in file profile_add_body.tpl

Code: Select all
[FIND]
<td class="row1"><span class="gen">{L_BIRTHDAY}:</span><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}<br /></td>

[REPLACE WITH]
<td class="row1"><span class="gen">{L_BIRTHDAY}:</span><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}</span><br /></td>
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Wed 01. May, 2002 02:00

PART 2 is now updated to ver 1.1.3.

missed som </span> tags in file
admin/user_edit_body.tpl

Code: Select all
[FIND]
<tr>
   <td class="row1"><span class="gen">{L_BIRTHDAY}:</span><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}<br /></td>
   <td class="row2"><input type="text" class="post"style="width: 80px"  name="birthday" size="10" maxlength="10" value="{BIRTHDAY}" /></td>
</tr>
<tr>
   <td class="row1"><span class="gen">{L_NEXT_BIRTHDAY_GREETING}:</span><br /><span class="gensmall">{L_NEXT_BIRTHDAY_GREETING_EXPLAIN}<br /></td>
   <td class="row2"><input type="text" class="post"style="width: 40px"  name="next_birthday_greeting" size="5" maxlength="4" value="{NEXT_BIRTHDAY_GREETING}" /></td>
</tr>

[REPLACE WITH]
<tr>
   <td class="row1"><span class="gen">{L_BIRTHDAY}:</span><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}</span><br /></td>
   <td class="row2"><input type="text" class="post"style="width: 80px"  name="birthday" size="10" maxlength="10" value="{BIRTHDAY}" /></td>
</tr>
<tr>
   <td class="row1"><span class="gen">{L_NEXT_BIRTHDAY_GREETING}:</span><br /><span class="gensmall">{L_NEXT_BIRTHDAY_GREETING_EXPLAIN}</span><br /></td>
   <td class="row2"><input type="text" class="post"style="width: 40px"  name="next_birthday_greeting" size="5" maxlength="4" value="{NEXT_BIRTHDAY_GREETING}" /></td>
</tr>
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Thu 23. May, 2002 09:15

I have restructured the PART 1 of this mod, original I have made it so the birthday data, was availble in most of the template files, but since I belive this feature wil not be used (haven't been so far) I have desided to move it to a more appropiate place
that way incresing the overall preformance of all pages on the forum slightly

therefore PART 1 new version is 1.1.12

here are how to upgrade
in file page_header.php
Code: Select all
[DELETE]
// Birthday Mod, Show users with birthday
$sql = "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username";
if($result = $db->sql_query($sql))
{
$birthdayrow = $db->sql_fetchrowset($result);
if (!empty($birthdayrow))
{
   $date_today = create_date('Ymd', time(), $board_config['board_timezone']);
   $date_forward = create_date('Ymd', time()+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
      for($i = 0; $i < count($birthdayrow); $i++)
      {
         $user_birthday=realdate("md",$birthdayrow[$i]['user_birthday']);
         $user_birthday2=(($year.$user_birthday<$date_today)? $year+1:$year).$user_birthday;
      if ($user_birthday2==$date_today)
         {
         //user have birthday today
         $user_age=$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
         $style_color = ($birthdayrow[$i]['user_level'] == ADMIN )?'style="color:#' . $theme['fontcolor3'] . '"':(( $birthdayrow[$i]['user_level'] == MOD )?'style="color:#' . $theme['fontcolor2'] . '"':'');
         $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
         }
      else if ($user_birthday2>$date_today  && $user_birthday2<=$date_forward)
      {
         // user are having birthday within the next days
         $user_age=($year.$user_birthday<$date_today)?$year- realdate ('Y',$birthdayrow[$i]['user_birthday'])+1:$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
         $style_color = ($birthdayrow[$i]['user_level'] == ADMIN )?'style="color:#' . $theme['fontcolor3'] . '"':(( $birthdayrow[$i]['user_level'] == MOD )?'style="color:#' . $theme['fontcolor2'] . '"':'');
         $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
      }
   }
}
}

[DELETE]
'L_WHOSBIRTHDAY_WEEK' => sprintf((($birthday_week_list)? $lang ['Birthday_week'].$birthday_week_list:$lang ['Nobirthday_week']),$board_config['birthday_check_day']),
'L_WHOSBIRTHDAY_TODAY' =>($birthday_today_list&&$board_config['birthday_check_day'])? $lang ['Birthday_today'].$birthday_today_list:$lang ['Nobirthday_today'],


then do the changes described in the "how-to" for the file index.php
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Next

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 0 guests

cron