Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_the_profile_field_value always returns ”1970 January 1st” in BP1.2.7

  • After upgrading BP to the latest 1.2.7, bp_the_profile_field_value always returns 1970/1/1 ignoring the input data (=date).
    This did not happen until BP upgraded to 1.2.7, thus I think this must be a new bug or an enbug.
    Currently, I have no idea how to fix it.

    I will be waiting awhile for someone to comment this post as I am not sure if this is due only to my environments.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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.


    Boone Gorges
    Keymaster

    @boonebgorges

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘bp_the_profile_field_value always returns ”1970 January 1st” in BP1.2.7’ is closed to new replies.
Skip to toolbar