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 !

Postby Niels on Sun 03. Aug, 2003 21:25

I have updated part 1 of this mod, to solve a language specific isue.

new version is 1.4.21.
to upgrade:
in file functions.php
Code: Select all
[FIND]
return date($date_syntax,$date*86400+1);

[REPLACE WITH9
return create_date($date_syntax,$date*86400+1,0);
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Wed 27. Aug, 2003 01:33

birthday mod is now tested for 2.0.6 and are EM ready
(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 Wed 27. Aug, 2003 11:00

I have uploaded new versions of the 3 zip files, there was some problems in the previous how-to's
(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 Wed 27. Aug, 2003 11:02

I have uploaded new versions of the 3 zip files, there was some problems in the previous how-to's

please not that the birthday mod may fail a autoinstalation with EM, if other mods are installed - in specific the last visit mod, since these 2 mods try to modify the same code, in this case change the installation scrip so it will work:
this part should be changed
#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every theme you use).
templates/subSilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<td class="row1" align="center" valign="middle" rowspan

#
#-----[ IN-LINE FIND ]------------------------------------------
#
# This value can be different, if other mods, add +1 to the value
2

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
# The find value can be different, if other mods, add +1 to the value
3


to correct it simply incease both the find value and the replace value
(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 09. Oct, 2003 20:50

zodiac add on is now 1.0.5., kooky have reported some isues, witch preveted displaying of zodiacs.

here are how to upgrade:
viewtopic.php
Code: Select all
         if ($poster_birthdate>=$zodiacdates[$n] & $poster_birthdate<=$zodiacdates[$n+1])


Should be:
Code: Select all
         if ($poster_birthdate>=$zodiacdates[$n] && $poster_birthdate<=$zodiacdates[$n+1])
Just added a & for &&

includes/usercp_viewprofile.php
Code: Select all
   $user_birthdate = realdate('md', $postrow[$i]['user_birthday']);


Should be:
Code: Select all
   $user_birthdate = realdate('md', $profiledata['user_birthday']);
(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 Mon 13. Oct, 2003 03:08

birthday mod are updated to version 1.5.2.

to upgrade:
in index.php
Code: Select all
[FIND]
.") ORDER BY username" : "";

[REPLACE WITH]
.") ORDER BY username" : "SELECT 1";
(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 Wed 10. Dec, 2003 10:27

the how-to have been re-written by -=ET=- and I have changed the code in index.php

it turn out that the code pressently used, could not handle year roll over

new version is therefore 2 steps, new version is 1.5.4.
to upgrade:
in index.php
Code: Select all
[FIND]
// Birthday Mod, Show users with birthday
$time_now = time();
$date_now = create_date('md', $time_now, $board_config['board_timezone']);
$date_forward = create_date('md', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
$sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday, user_level FROM ".USERS_TABLE." WHERE user_birthday<>999999 AND
(user_birthday<0 OR DATE_FORMAT(FROM_DAYS(user_birthday),'%m%d') BETWEEN ".(($date_now<$date_forward) ? "'($date_now+0)' AND '$date_forward'" : "'($date_now+0)' AND '1231' OR DATE_FORMAT(FROM_DAYS(user_birthday),'%m%d') BETWEEN '0101' AND '$date_forward'") .") ORDER BY username" : "SELECT 1";
if(!$result = $db->sql_query($sql))
{
        message_die(GENERAL_ERROR, "Could not fetch birthday for users.", "", __LINE__, __FILE__, $sql);
} else
{
   $birthdayrows = array();
   $birthdayrows = $db->sql_fetchrowset($result);
}
   if (!empty($birthdayrows))
   {
      $this_year = create_date('Y', $time_now, $board_config['board_timezone']);
      $date_today = $this_year.$date_now;
      $date_forward = $this_year.$date_forward;
         while (list($user_number, $birthdayrow) = each($birthdayrows))
      {
            $user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
         // give user a year more, if he alread have had birthday
            if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
         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'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';                  break;
               case MOD :
                     $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';                  break;
               default: $style_color = '';
            }
            $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
            } else 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'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';break;
               case MOD :
                     $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';break;
               default: $style_color = '';
            }
            $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
         }
      }
      if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
      if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
   }
if (isset($result))
{
   $db->sql_freeresult($result);
}



[REPLACE WITH]
// 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))
      {
usleep(2);
            $user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
            if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
         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'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
                  break;
               case MOD :
                     $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
                  break;
               default: $style_color = '';
            }
            $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
         } 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'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
                  break;
               case MOD :
                     $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
                     $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
                  break;
               default: $style_color = '';
            }

            $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
            }
         
      }
      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);
}
(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 22. Apr, 2004 22:13

I have update this mod to version 1.5.5.
it did turn out that a error would be displayed on the index, if one or more users did have special chars in the username
to fix this upgrade to lates version.

to upgrade 1.5.4. -> 1.5.5.
in file index.php
Code: Select all
[FIND]
'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']) : '',

[REPLACE WITH]
'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day'] > 1) ? sprintf( (($birthday_week_list) ? $lang['Birthday_week'] : $lang['Nobirthday_week']), $board_config['birthday_check_day']).$birthday_week_list : '',
(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

PreviousNext

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron