By Sabih on Saturday, 18 March 2017
Replies 4
Likes 0
Views 885
Votes 0
I am trying to achieve showing the age inside the popbox. This works fine but not all the time. Some profiles show "unable to load tooltip" but most profiles are working. I am trying to find out what causes this problems. Maybe someone can help?

What I did so far:

I have edited "components/com_easysocial/themes/wireframe/profile/popbox/user.php" and added the following code:


<?php
$id = JRequest::getInt( 'id' , null );
// current user profile id
$user = Foundry::user($id);
// Get your current birthday custom field unique key e.g. BIRTHDAY
$birthdayDate = $user->getFieldValue('BIRTHDAY');
// Pass birthday date into this section
$birthDate = new DateTime($birthdayDate);
$now = new DateTime();
// Use this formula generate to age
$age = floor(($now->format('U') - $birthDate->format('U')) / (60*60*24*365));
echo "($age)";
// Result
?>


From line 9 on there seems to be a problem but due to my nearly non-existent programming skills I am not able to find it...
*last hope by pushing this once*
·
Wednesday, 22 March 2017 14:13
·
0 Likes
·
0 Votes
·
0 Comments
·
If I put the snippet in the users profile, I got following error message:

0 DateTime::_construct(): Failed to parse time string (01 Januar 1964) at position 6 (u): The timezone could not be found in the database.


So there must be something wrong in the way the date is saved. Since "Januar" is the german one and the system seems to need the english one.
·
Thursday, 23 March 2017 20:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Still hoping for someone that might offer a solution for this.
·
Saturday, 06 May 2017 21:21
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post