Display age on profile if a year has been entered.

This commit is contained in:
flash 2019-07-03 02:18:33 +02:00
parent 78e17eb4e5
commit 05db5e00cf
2 changed files with 2 additions and 1 deletions

View file

@ -206,6 +206,7 @@ function user_profile_get(int $userId): array {
u.`user_about_parser`, u.`user_about_content`,
u.`user_signature_parser`, u.`user_signature_content`,
%1$s,
TIMESTAMPDIFF(YEAR, IF(u.`user_birthdate` < \'0001-01-01\', NULL, u.`user_birthdate`), NOW()) AS `user_age`,
COALESCE(u.`user_title`, r.`role_title`) AS `user_title`,
COALESCE(u.`user_colour`, r.`role_colour`) AS `user_colour`,
`user_background_settings` & 0x0F AS `user_background_attachment`,

View file

@ -42,7 +42,7 @@
<div class="profile__header__country">
<div class="flag flag--{{ profile.user_country|lower }}"></div>
<div class="profile__header__country__name">
{{ profile.user_country|country_name }}
{{ profile.user_country|country_name }}{% if profile.user_age > 0 %}, {{ profile.user_age }} year{{ profile.user_age != 's' ? 's' : '' }} old{% endif %}
</div>
</div>
{% else %}