Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_profile_field_data( ‘field= … doesn’t work

  • Avatar of PJ
    PJ
    Participant

    @pjnu

    I’m trying to customize the profile header a bit but I think it only displays raw text, not other filed types.

    I saw this at http://bp-tricks.com/snippets/displaying-certain-profile-fields-on-your-members-profile-page/

    BuddyPress can display checkbox fields fine as a list in the profile, but it can’t if I list it manually? If I do, it just says “Array” which isn’t appealing.

    Is there any way to pull/display checkbox fields or multi-line select using a line or two of code like that? Thanks.

Viewing 21 replies - 1 through 21 (of 21 total)
  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Try bp_member_profile_data() instead.

    The documentation in the code is incorrect and as you’ve noticed bp_profile_field_data() doesn’t work for the complex data types.

    Avatar of PJ
    PJ
    Participant

    @pjnu

    Hmm. I tried it but nothing shows up.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    When the stored data is an array you have to process it

    `$arr = bp_get_profile_field_data( ‘field=’ );

    foreach ($arr as $value) {
    echo “Value: $value
    n”;
    }`

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @modemlooper – the new function I’ve given handles array data types, so you don’t have to write any of your own conditional code to catch and process array types.

    You should switch your code to use bp_member_profile_data()

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @PJ – not sure why the function isn’t working for you — have you got the field name correct?

    Paste your code in this thread, and someone might be able to spot what you are doing wrong.

    Avatar of Andrew Tibbetts
    Andrew Tibbetts
    Participant

    @andrewgtibbetts

    I also am getting nothing with bp_profile_field_data. It is spitting out the values in my regular theme’s member-header.php but when I plunk it into the BPMobile theme, nothing. Any ideas?

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Paste code your using

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @andrewgtibbets — try the function I’ve suggested in the thread: bp_member_profile_data()

    Avatar of Andrew Tibbetts
    Andrew Tibbetts
    Participant

    @andrewgtibbetts

    bp_profile_field_data(‘field=Company’); works in my desktop theme, not in mobile. I tried bp_member_profile_data(‘field=Company’);, still nothing.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    I’ll test it

    Avatar of Andrew Tibbetts
    Andrew Tibbetts
    Participant

    @andrewgtibbetts

    Holy shitake mushrooms…I’m an idiot. The user I’m working with didn’t have any values in any of the fields. Please ignore. Keep moving. Nothing to see here.

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    Hi I am trying to display members telephone#s in the members directory using bp_profile_data_field and I was able to get the email but I was not able to get the telephone number for some reason.
    I used bp_member_profile_data(‘field=31′); which I made under user profile fields.
    But it still did not work. For the email I used the same exact syntax bp_member_profile_data(‘field=30′) and it worked for me.But the phone number I am having trouble with.
    Any advise on how to do this would be helpful.

    Running the latest version of WP/BP

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    Bump

    Can anyone give me any insight on this?

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    Can anyone give me some insight into getting phonenumber to display using bp_profile_field_data() within member-loop.php

    It does not work for me.

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    Can one of the moderators help out please.

    Avatar of valuser
    valuser
    Participant

    @valuser

    not a moderator just a Participant

    Try

    Where Phone Number is an xprofile field

    put the code at http://pastebin.com/Zb12M7cz in your members-loop.php

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    @valuser Thanks for the reply. But it still does not work.
    Someone said to try this, but it does not work for me. Any reason to why do you know?

    <?php echo 'phone: ‘; ?>

    Thanks

    Avatar of valuser
    valuser
    Participant

    @valuser

    I have presumed that Phone Number is the exact name of your Profile field. Is it ?

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    It is Telephone #.
    Ooh for some reason my code didnt show up.

    <?php echo 'phone: ‘; ?>

    Avatar of mlabrooy
    mlabrooy
    Participant

    @mlabrooy

    And I also tried switching Phone Number with Telephone # in the function and still does not work.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    You will hit problems if you edit the data type of a field once data is stored in the db. e.g changing a text field to a checkbox will cause problems with the documented code as you need to process the array (as @modemlooper pointed out).

    The easy way around changing the type of an existing field is to delete field and create a new one (don’t ‘edit’ it).

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

You must be logged in to reply to this topic.