[Fixed] Both January and October BD's show in October

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 London on Mon 27. Oct, 2003 17:15

What version board is that solution for? I'm running 2.04 and added the code like m-a-b suggested and still didn't solve the problem...any help anyone?
London
Poster
Poster
 
Posts: 8
Joined: Thu 31. Jul, 2003 18:03

Postby parad0x on Tue 28. Oct, 2003 01:06

Well, at least I'm not alone in with this issue :roll:

@m-a-b I tried your code. While it did weed out the people with Birthdays in January, it also removed people with birthdays in October :?

I had planned on taking a deeper look at the problem, but have not had the time as of yet :(
parad0x
Poster
Poster
 
Posts: 18
Joined: Sun 23. Mar, 2003 23:52

Postby m-a-b on Tue 28. Oct, 2003 11:38

London wrote:What version board is that solution for? I'm running 2.04 and added the code like m-a-b suggested and still didn't solve the problem...any help anyone?


i've also phpbb 2.0.4
m-a-b
Poster
Poster
 
Posts: 6
Joined: Mon 31. Mar, 2003 19:54

Postby m-a-b on Tue 28. Oct, 2003 11:40

London wrote:What version board is that solution for? I'm running 2.04 and added the code like m-a-b suggested and still didn't solve the problem...any help anyone?


you have to overwrite the old code (from birthday-mod) in index.php with this one i posted.
m-a-b
Poster
Poster
 
Posts: 6
Joined: Mon 31. Mar, 2003 19:54

Postby London on Tue 28. Oct, 2003 22:09

Hey m-a-b...thanks for your reply..I did overwrite index.php with your one..here's how my code looks now...from line 317-386.

Code: Select all
//
// 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);
}
   //
   // Start output of page
   //
   define('SHOW_ONLINE', true);
   $page_title = $lang['Index'];
   include($phpbb_root_path . 'includes/page_header.'.$phpEx);


Thanks in advance.
London
Poster
Poster
 
Posts: 8
Joined: Thu 31. Jul, 2003 18:03

Postby npoly on Wed 29. Oct, 2003 01:35

I just had the same problem...m-a-b's solution worked perfect. Thanks for the fix :D

I was running phpbb 2.0.6 on both windows and linux servers. Worked for both...
npoly
Poster
Poster
 
Posts: 1
Joined: Wed 29. Oct, 2003 01:14
Location: New York

Postby parad0x on Wed 29. Oct, 2003 01:52

kooky, have you had any luck with this "fix"?
parad0x
Poster
Poster
 
Posts: 18
Joined: Sun 23. Mar, 2003 23:52

Postby London on Wed 29. Oct, 2003 18:56

I hope this is solved...unfortunately for me, m-a-b's soultion did not work, I had some members name repeated twice on the b0day announcement when I tried it
London
Poster
Poster
 
Posts: 8
Joined: Thu 31. Jul, 2003 18:03

PreviousNext

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron