[Fixed] Birthday lookforward error !!!

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 kooky on Mon 08. Dec, 2003 02:34

spritzkuchen wrote:Hi,

i dont think so, because i also have this problem ;(

i think i 'm right because i haven't this problem :)
kooky
brilliant supporter
 
Posts: 1329
Joined: Tue 31. Dec, 2002 17:52
Location: Au pays des rêves

Postby anand on Tue 09. Dec, 2003 05:04

Thanks GFM, changing the lookahead fixes it for me too, for now. I'll double check my changes and make sure they're all correct...
anand
Poster
Poster
 
Posts: 4
Joined: Thu 23. Oct, 2003 07:34

Postby nefterra on Tue 09. Dec, 2003 09:36

i have tried the code by nepolia, don't work
i have tried the idea by GFM --> GOOD !

Thanks !
nefterra
Poster
Poster
 
Posts: 2
Joined: Sun 02. Nov, 2003 14:29
Location: France !

Postby kooky on Tue 09. Dec, 2003 15:59

OK you are right

There is an error in index.php for the look forward.
When you set more than 20 days, no birtday will appear in december

Niels is warned about this, we try to fix this error ;)
Therefore don't try to install birthday Mod or just set your days look forward for 20 days
kooky
brilliant supporter
 
Posts: 1329
Joined: Tue 31. Dec, 2002 17:52
Location: Au pays des rêves

Postby Niels on Wed 10. Dec, 2003 00:09

I would suspect the changes done to index.php in version 1.4.17. may have caused this.

please use this code in index.php instead

Code: Select all
// 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 += 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

Previous

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron