Check out our Monthly Survey Page to see what our users are running.
Cake-day displaying wrong amount of years!
Pengling 19 Feb 2024
Well this is an odd one! I just hopped online, and yay, it's my cake-day, I've been here for two years now! But, if I mouse over the cake, it says "Pengling has been here for 1 years" - I think the counter's gotten a bit confused, Liam...
StoneColdSpider 19 Feb 2024
Well this is an odd one! I just hopped online, and yay, it's my cake-day, I've been here for two years now! But, if I mouse over the cake, it says "Pengling has been here for 1 years" - I think the counter's gotten a bit confused, Liam...
So you could say the cake is a lie???.......

Naaaaa the counter just wishes you wernt around as much....... I can relate to that......

J/K......
Congrats on your cake day!!!.......
BlackBloodRum 19 Feb 2024
  • Supporter Plus
Right, managed to stop myself laughing at the blowfly/prince of space long enough to answer, anyway, I'm going to take a pot-luck guess at the cause here:

So, the website appears to be detecting "cake day" by the date, which makes sense. But the actual calculation for the length of time registered used by the cake is probably a calculation based on timestamps. You registered around ~8PM, so as far as that calculation is concerned you haven't been here 2 years until 8PM passes.

So, if it's this, it should be a 2-minute fix for Liam.

(Bear in mind, I don't have access to the code so, I could be totally wrong.)
Ehvis 19 Feb 2024
(Bear in mind, I don't have access to the code so, I could be totally wrong.)

https://gitlab.com/liamdawe/gamingonlinux

So, now you should be able to tell us.
whizse 19 Feb 2024
Well this is an odd one! I just hopped online, and yay, it's my cake-day, I've been here for two years now! But, if I mouse over the cake, it says "Pengling has been here for 1 years" - I think the counter's gotten a bit confused, Liam...
In other words, until the bug is fixed you only deserve half a cake? That I can fix: !cake!

BlackBloodRum 19 Feb 2024
  • Supporter Plus
(Bear in mind, I don't have access to the code so, I could be totally wrong.)

https://gitlab.com/liamdawe/gamingonlinux

So, now you should be able to tell us.
Interesting!

So, from:
https://gitlab.com/liamdawe/gamingonlinux/-/blob/master/public_html/includes/class_user.php?ref_type=heads#L583

We got:
 
// give them a cake icon if they have been here for x years
public function cake_day($reg_date, $username)
{
$date1 = new DateTime();
$date1->setTimestamp($reg_date);

$date2 = new DateTime();

$cake_icon = '';
if ($date1->format('d-m') === $date2->format('d-m')) 
{
// calculate how many years
$total_years = $date1->diff($date2)->format('%y');
if ($total_years > 0)
{
$cake_icon = '<img src="/templates/default/images/cake.png" alt="'.$total_years.' years" class="tooltip-top" title="'.$username.' has been here for '.$total_years.' years" />';
}
}
return $cake_icon;
}


It's doing a difference comparison between $date2 (unformatted therefore, current timestamp) with $date1 which has been set to the users registration timestamp, so we're comparing timestamps.
Liam Dawe 19 Feb 2024
Concerning.

Looking into it.
Liam Dawe 19 Feb 2024
Fixed.
Pengling 19 Feb 2024
So you could say the cake is a lie???.......
Haha!

J/K......
Congrats on your cake day!!!.......
Thanks man.

Right, managed to stop myself laughing at the blowfly/prince of space long enough to answer,
A classic!

In other words, until the bug is fixed you only deserve half a cake? That I can fix: !cake!

Aw, you took half my cake!

Fixed.
Yay, thanks Liam! Now I can be proud of that cake!
Liam Dawe 19 Feb 2024
Because there could be some random timing differences when doing the date comparison, I simply moved it over to a basic year minus year. Simpler solution. May not *always* be exact with leap years and such, but generally will be more accurate on just a basic "yay it's been x years".
BlackBloodRum 20 Feb 2024
  • Supporter Plus
Because there could be some random timing differences when doing the date comparison, I simply moved it over to a basic year minus year. Simpler solution. May not *always* be exact with leap years and such, but generally will be more accurate on just a basic "yay it's been x years".
I don't think it has to be overly exact, just needs to work. Your solution description sounds good enough and fixed the issue, what more could someone want?
Pengling 21 Feb 2024
what more could someone want?
An actual cake sent by courier?
BlackBloodRum 21 Feb 2024
  • Supporter Plus
what more could someone want?
An actual cake sent by courier?
I'm sure Liam will set that up!
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register