Though I tried both “https://trac.buddypress.org/ticket/2947” and “https://trac.buddypress.org/ticket/2240”, the problem prolongs.
The reason why 1970 January 1st is always displayed is that bp_the_profile_field_value and/or related functions always return “0” ignorring the true value.
I need to use date(‘Y/m/d’) instead of bp_the_profile_field_value for “datebox” for the time being…
Anybody has any idea?
Because I know the field name or id for datebox, and I use onlye one datebox for birthday, I changed as following just for myself:
At around line 40 of profile-loop.php located in /wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile
[ Original ]
<?php bp_the_profile_field_value() ?>
[ Changed ]
<?php
if (bp_get_the_profile_field_name() == ‘FIELD NAME’) {
echo date(‘DATE FORMAT’,xprofile_get_field_data(“FIELD NAME or FIELD ID”));
}
else {
bp_the_profile_field_value();
}
?>
Note that DATE FORMAT, FIELD NAME and FIELD ID are to be replaced with the true value.
Once again, this is just only temporary fix, and I still wait until someone comments to this post. Currently, I am wandering if I post to http://trac.buddypress.org.
I’m not able to reproduce the problem on my installations of 1.2.7. bp_get_the_profile_field_value() is returning the correct UNIX timestamp for dates.
Are you running other BP-related plugins? Have you tried reproducing the problem with those plugins deactivated?
Thank you for your comment, @boonebgorges
Yes, I use several bp-related plugins, but all of them were already used with BP 1.2.6.
Since the proplem began surfacing right after BP was upgraded to 1.2.7, I thought it would be a bug in 1.2.7.
I will once again test 1.2.7 with bp-related plugins deactivated.
I found the reason.
At line 826 of bp-core/bp-core-templatetags.php:
$date = date( ‘F j, Y ‘, $time_offset );
It was my mistake, as I made a typo of “offest” when I change the above time format to Japanese one.
Fixing “offest” to “offset” let the problem disappear.
Thank you very much, @boonebgorges.
Without your comment, I would not have noticed my mistake.