BuddyDev

Search

[Resolved] echo Multi select boxes -> array

  • Participant
    Level: Initiated
    Posts: 10
    Han on #21755

    hi, i am trying to echo a xprofile field tha is a Multi select box. i am using one of your solutions givenin here: https://buddydev.com/fetching-and-showing-only-specific-fields-from-buddypress-xprofile-data/#comment-3439

    ‘echo bp_unserialize_profile_field( xprofile_get_field_data( ‘CheckboxFieldName’, get_the_author_id()) ) );’

    the only result i get is “Array”. the ocde works fine when normal fields are echoed.

    I hope you can find time to help me.

    Best,
    Han

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #21773

    Hi Han,
    You can use this instead

    
    
    xprofile_get_field_data( 'CheckboxFieldName', get_the_author_id(), 'comma' );
    
    

    Also, there is no need to use bp_unserialize_profile_field(). BuddyPress does that automatically for you when you use xprofile_get_field_data.

    Please let me know if it works for you or not?

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Han on #21781

    hi Brajesh, just perfect!
    thank you.

    regards, Han

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #21784

    You are welcome.

The topic ‘ [Resolved] echo Multi select boxes -> array’ is closed to new replies.

This topic is: resolved