Skip to:

[Resolved] Possible bug with bp_member_profile_data and Date Selector?

  • Brendino


    WP 3.5.1, BP 1.7-b1.

    I elaborate on the problem a bit more here, but the gist of it is that I tried to call a datebox with bp_member_profile_data() and it didn’t work. I’m not a programmer, but I was able to go through the source and isolate the problem; it happens in xprofile_format_profile_field() in bp-xprofile/bp-xprofile-functions.php when the following is passed:

    `$field_value = bp_format_time( $field_value, true );`

    bp_format_time is definitely causing the problem. I was able to get it to show by doing the following things:

    • Comment out the line that’s causing the problem.
    • Wrap $field_value in strtotime() when calling bp_format_time. The resulting dates were off by a day, but it otherwise displayed as expected.
    • Go into the bp_format_time function and, with
      `if ( !isset( $time ) || !is_numeric( $time ) )
      return false;` change false to $time.

    Remember, I don’t really know what I’m doing. I don’t know exactly what the problem is and what the proper fix would be, or how that fix would affect other parts of the site. Just wanted to share what I found, and if someone has a solution, that’d be really helpful! I have a workaround but I’d like to use bp_member_profile_data as intended.

Viewing 4 replies - 1 through 4 (of 4 total)

  • imath


    Hi Brendino,

    I think it’s a bug in the function xprofile_format_profile_field as it’s working great when seeing the birthday in the profile of the user. I’ve just posted this ticket on the dev trac.

    While waiting for core developers review / patch, i suggest you to use this little hack to achieve what you’re trying to do. Adapt your snippet this way :

    if ( bp_has_members() ) :
        while ( bp_members() ) : bp_the_member();
            echo bp_member_name();
            echo ': ';
            /* this functions is detailed after */
            echo '<br />';

    Now in the functions.php of your active theme, paste the content of the xprofile_birthday_patch() function :

    function xprofile_birthday_patch() {
    	$birthday = xprofile_get_field_data( 'Birthday', bp_get_member_user_id() );
    	if ( is_numeric( $birthday ) )
    		$birthday = bp_format_time( $birthday, true, false );
    		$birthday = bp_format_time( strtotime( $birthday ), true, false );
    	echo $birthday;



    Thanks so much for going the extra mile and proposing the patch! I appreciate your help 🙂



    This is astounding and it works – THANK YOU!

    I am able to see what I need (just the info) however, how can I omit the date? I need to show only the Month and the Year, for my purposes.



    Merci Imath ! Thx Imath 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Possible bug with bp_member_profile_data and Date Selector?’ is closed to new replies.
Skip to toolbar