BuddyDev

Search

Render field data from the From/To values Field Type?

  • Participant
    Level: Yogi
    Posts: 1105
    calu on #48866

    Hi there, I have a question about using From/To values Field Type, field_data with this code.

    https://buddydev.com/support/forums/topic/show-xprofile-field-data-in-the-profile-header-exclude-own-profile-2/#post-32490

    The return is Array, is it simply not possible to output the field data from the From/To values Field Type?

    Regards
    Carsten

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #48869

    Please try passing 3rd parameter to xprofile_get_field_data as ‘comma’.

    e.g.

    
    xprofile_get_field_data( 'From', bp_displayed_user_id(), 'comma' );
    
    

    Regards
    Brajesh

  • Participant
    Level: Yogi
    Posts: 1105
    calu on #48876

    Thanks Brajesh, it’s working.

    How do I add a hyphen like this 45–55 between the values, instead of 45,55?

    Regards
    Carsten

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #48889

    Hi Carsten,
    BuddyPress does not call display filter on the value if you are using it outside the loop(profile loop).

    You may call

    
    
    $formatted = xprofile_filter_format_field_value_by_field_id(xprofile_get_field_data( 'From', bp_displayed_user_id(), 'comma' ), $from_field_id);
    
    

    To get the formatted data. Please make sure you provide the correct from field id.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved