TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 73
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 60
  • Total: 60

Bug in SSI.php ??

Started by feline, November 29, 2005, 11:14:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

feline

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

bloc

Hm, it should not do that...is the forum a SMF 1.1RC1?

feline

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

bloc

Does it do this on default theme as well? or only on Black22 theme?

Also..just this member - or has it happened to several?

feline

#4
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

feline

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

winrules

It's actually supposed to do that...All the "Todays" ssi functions actually go like 1 week (U think) in the future.

feline

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

bloc

Good you solved it. :)

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

This website is proudly hosted on Crocweb Cloud Website Hosting.