Autor Tópico: Vista lateral mostrando a idade (1.1.x + 2.0)  (Lida 2493 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5072
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Vista lateral mostrando a idade (1.1.x + 2.0)
« em: 09 de Dezembro de 2010, 22:47 »
Display.template.php

Código: [Seleccione]
// Show how many posts they have made.
Código: [Seleccione]
// Calculate their age! Hopefully they are not too old ;)
if (!empty($message['member']['birth_date']))
{
if ($message['member']['birth_date'] != '0000-00-00')
{
list ($birth_year, $birth_month, $birth_day) = sscanf($message['member']['birth_date'], '%d-%d-%d');
$datearray = getdate(forum_time());
$message['member'] += array(
'age' => empty($birth_year) ? $txt[470] : $datearray['year'] - $birth_year - (($datearray['mon'] > $birth_month || ($datearray['mon'] == $birth_month && $datearray['mday'] >= $birth_day)) ? 0 : 1),
'today_is_birthday' => $datearray['mon'] == $birth_month && $datearray['mday'] == $birth_day
);
}
}

// Age
if (!empty($message['member']['age']))
echo '
Yaş: ', $message['member']['age'], '<br />';


2.0.x

Código: [Seleccione]
// Calculate their age! Hopefully they are not too old ;)
if (!empty($message['member']['birth_date']))
{
if ($message['member']['birth_date'] != '0000-00-00')
{
list ($birth_year, $birth_month, $birth_day) = sscanf($message['member']['birth_date'], '%d-%d-%d');
$datearray = getdate(forum_time());
$message['member'] += array(
'age' => empty($birth_year) ? $txt['not_applicable']  : $datearray['year'] - $birth_year - (($datearray['mon'] > $birth_month || ($datearray['mon'] == $birth_month && $datearray['mday'] >= $birth_day)) ? 0 : 1),
'today_is_birthday' => $datearray['mon'] == $birth_month && $datearray['mday'] == $birth_day
);
}
}

// Age
if (!empty($message['member']['age']))
echo '
<li>Yaş: ', $message['member']['age'], '</li>';