TinyPortal

Development => Support => Topic started by: feline on November 29, 2005, 11:14:40 AM

Title: Bug in SSI.php ??
Post by: feline on November 29, 2005, 11:14:40 AM
Hi bloc,

i think, it's a bug ...

I'm using the function todaybirstday ..
the function displays today (11. 29.) a person that have birstday on 12. 05.  >:(

can you get my help?

Feline
Title: Re: Bug in SSI.php ??
Post by: bloc on November 29, 2005, 01:02:54 PM
Hm, it should not do that...is the forum a SMF 1.1RC1?
Title: Re: Bug in SSI.php ??
Post by: feline on November 29, 2005, 03:17:06 PM
yes bloc .. it is.

SMF Paket   SMF 1.1 RC1   SMF 1.1 RC1
Calendar.php   1.1 RC1   1.1 RC1
SSI.php   1.1 RC1   1.1 RC1
Calendar.template.php   1.1 RC1   1.1 RC1


Display:
Geburstage: PatriciaZ (43)

Profile:
Geburtsdatum:      1962 - 12 -05

Feline
Title: Re: Bug in SSI.php ??
Post by: bloc on November 29, 2005, 03:27:50 PM
Does it do this on default theme as well? or only on Black22 theme?

Also..just this member - or has it happened to several?
Title: Re: Bug in SSI.php ??
Post by: feline on November 29, 2005, 06:27:00 PM
Hi Bloc,

does on all themes ... Black, Blue, and default

and this member .. no other birstdays on nov or dec.

my code:
          $BirstDayMember= ssi_todaysBirthdays(''); flush();
          if ($BirstDayMember) {
            echo 'Geburstag: <b>';
            foreach($BirstDayMember as $BDMember)
              echo $BDMember['name'], (!$BDMember['is_last']) ? ', ' : '</b>&nbsp;&nbsp;';
          }


Fel
Title: Re: Bug in SSI.php ??
Post by: feline on November 29, 2005, 06:35:39 PM
hi bloc,

wupii .. I have found ...

modify code in SSI.php
// Happy Birthday, guys and gals!
$context['calendar_birthdays'] = array();
// -removed for ($i = $now; $i < $now + $days_for_index; $i += 86400)
// -removed {
        $i = $now;   // -added
if (isset($bday[strftime('%Y-%m-%d', $i)]))
{
foreach ($bday[strftime('%Y-%m-%d', $i)] as $index => $dummy)
$bday[strftime('%Y-%m-%d', $i)][$index]['is_today'] = (strftime('%Y-%m-%d', $i)) == strftime('%Y-%m-%d', forum_time());
$context['calendar_birthdays'] = array_merge($context['calendar_birthdays'], $bday[strftime('%Y-%m-%d', $i)]);
}
//-removed }


this works fine  ::)

Feline
Title: Re: Bug in SSI.php ??
Post by: winrules on November 29, 2005, 09:33:45 PM
It's actually supposed to do that...All the "Todays" ssi functions actually go like 1 week (U think) in the future.
Title: Re: Bug in SSI.php ??
Post by: feline on November 30, 2005, 01:45:11 AM
yes winrules, that is the problem.

to display only today birthdays use this ...

new code block for function ssi_todaysBirthdays($output_method = 'echo')

// Show today's birthdays.
function ssi_todaysBirthdays($output_method = 'echo')
{
global $context, $scripturl, $modSettings;

if (!smf_loadCalendarInfo() || empty($context['calendar_birthdays']))
return array();

if (isset($modSettings['cal_today_birthday']))
$bday = unserialize($modSettings['cal_today_birthday']);

$i = forum_time();
$context['birthdays'] = array();

if (isset($bday[strftime('%Y-%m-%d', $i)]))
$context['birthdays'] = array_merge($context['birthdays'], $bday[strftime('%Y-%m-%d', $i)]);

if ($output_method != 'echo')
return $context['birthdays'];

foreach ($context['birthdays'] as $member)
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');
}


No other changes necessary.
This will work for today and preview of birthdays also ...

feline
Title: Re: Bug in SSI.php ??
Post by: bloc on December 01, 2005, 06:56:18 PM
Good you solved it. :)

Strange that this hasn't been adressed over at Simplemachines.org..or maybe it has( but not discovered by me ::) )