Customizing SMF > SMF Coding Discussion

Calendar not to display age

(1/5) > >>

The Wizard:
In the Calendar I would like to display all the user names and birthdays, but not their age. I know there is a option in the Calendar settings to show the users birthday and age. I want to add a option in the Calendar settings to only show their birthdays.
I found In the Sources/Subs-Calendar.php the code below. that I think controls this feature but I don't know how to pull this off.   



--- Quote ---$bday = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
if ($year_low != $year_high)
$age_year = substr($row['birthdate'], 5) < substr($high_date, 5) ? $year_high : $year_low;
else
$age_year = $year_low;
$bday[$age_year . substr($row['birthdate'], 4)][] = array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'age' => $row['birth_year'] > 4 && $row['birth_year'] <= $age_year ? $age_year - $row['birth_year'] : null,
'is_last' => false
);
}
--- End quote ---

mashby:
That's one place to look, but the display is in the Themes files. Maybe tackling it there would be better. In Themes/default/Calendar.template.php, find this:

--- Code: --- foreach ($day['birthdays'] as $member)
{
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide)? '' : ', ';

// Stop at ten?

--- End code ---

Maybe make that be:

--- Code: --- foreach ($day['birthdays'] as $member)
{
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['name'], '</a>', $member['is_last'] || ($count == 10 && $use_js_hide)? '' : ', ';

// Stop at ten?

--- End code ---

The Wizard:
This looks good but how would you hook up the option to the Calendar settings?

mashby:
I'm going to plead ignorance as the settings are to show everything about the birthday (if the user allows), not just the age. All I did was remove the age from ever displaying. Isn't that what you're after? :)

The Wizard:
I want a check box in the admin area under calender settings so I can trun the age off or on in the calendar. If your going to do something do it right the first time. I don't want to fiddle with code if I change my mind a month from now.

Navigation

[0] Message Index

[#] Next page

Go to full version