Seite 2 von 2

Verfasst: 19.11.2003 09:32
von oxpus
Ich hab das jetzt mal so eingebaut und das funzt bei mir:

Code: Alles auswählen

   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'] );
	    include_once("includes/functions_color_groups.".$phpEx);
	    switch ($birthdayrow['user_level'])
            {
               case ADMIN :
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>';
                     break;
               case JUNIOR_ADMIN :
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>';
                     break;
               case MOD :
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>';
                     break;
               default: $style_color = '';
            }
            $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '">' . color_group_colorize_name($birthdayrow['user_id'], true) . ' ('.$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']);
	    include_once("includes/functions_color_groups.".$phpEx);
            switch ($birthdayrow['user_level'])
            {
               case ADMIN :
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>';
                     break;
               case JUNIOR_ADMIN :
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>';
                     break;
               case MOD :
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>';
                     break;
               default: $style_color = '';
            }
            $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '">' . color_group_colorize_name($birthdayrow['user_id'], true) . ' ('.$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] = ' ';
   }
Das gleiche kann man natürlich auch für Super-Mods machen...

OXPUS

Verfasst: 25.01.2004 20:51
von TheRealKoston
Oxpus funktioniert das auch in dem aktuellen Bday mod?

Code: Alles auswählen

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);


was müsst ich da änderen :) ?

Verfasst: 25.01.2004 21:17
von oxpus
Das hier (2x!):

Code: Alles auswählen

              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 = '';
in dieses ändern

Code: Alles auswählen

               case ADMIN : 
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>'; 
                     break; 
               case JUNIOR_ADMIN : 
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>'; 
                     break; 
               case MOD : 
                     $birthdayrow['username'] = '<b>' . color_group_colorize_name($birthdayrow['user_id'], true) . '</b>'; 
                     break; 
               default: $style_color = '';

Verfasst: 25.01.2004 21:26
von TheRealKoston
huhu, danke :)
aber kann man einstellen, das Alter auch farbig wird (z.b. (17))
und es in der richtigen farbe unterstrichen ist :) ?

hab mal nen screenshot beigelegt:
[ externes Bild ]

sorry wegen der shclechten Farbqualität aber wollte das Bild klein halten (11 kb)

Verfasst: 25.01.2004 21:42
von oxpus
Das ist mit dem Color Groups Mod nicht so ohne weiteres möglich...

Verfasst: 25.01.2004 21:45
von TheRealKoston
schade ;(

naja trotzdem Danke :)

vielleicht hat ja einer die Lösung =)

Verfasst: 26.01.2004 00:59
von oxpus
Sagen wir es mal so: Eine Lösung könnte ich schon liefern, aber da spricht in meinen Augen etwas gewaltig dagegen:
Die Last auf der Datenbank!
Der Color Group Mod wird bereits in der Standard-Version für jeden User einmal aufgerufen (genauer die Funktion für die User-Farbe). Und genau an diesem Aufruf muss man dann auch den Geburtstag des Users auslesen und berechnen, damit es ebenfalls in der selben Farbe dargestellt werden kann.
Im günstigsten Fall klappt daß in der selben Abfrage, aber die zusächstliche Berechnung bremst das Board mehr aus. Bei vielen gleichzeitig aktiven Usern würde man das merken und daher rate ich eher davon ab und auch ich lebe daher lieber mit farbigen Usernamen und "einfachen" Altersangaben...

Verfasst: 26.01.2004 14:38
von TheRealKoston
ok, seh ich ein :)

Verfasst: 28.03.2004 20:09
von eVo
@oxpus
Danke für die schnelle und unkomplizierte Integration!
Funkutioniert wunderbar.

Gruß eVo