Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding custom profile fields to Member Profile


  • ebraxton30
    Participant

    @ebraxton30

    I’ve been trying to add custom fields to the member profiles and have not been successful.

    I tried to add

    bp_member_profile_data( ‘field=the field name’ ) to the
    members-loop.php
    It’s not working.  Could someone tell me if I’m doing something wrong?

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

  • modemlooper
    Moderator

    @modemlooper

    In the WordPress Admin under the Users you will see a link called prifile fields. This is where you create fields.


    ebraxton30
    Participant

    @ebraxton30

    Yea…I got that.  Did that.  I’m trying to use the code above to make them show up on the members page and the single members page and it’s not working.

    When I try to add the code in, it’s not showing up and I think it’s because I’m not inserting it exactly right.  I see the location that it is supposed to be, but I’m not sure I’m keying in the correct characters.  Can someone help me with the exact location and characters?  Is this the right code?

    <?php bp_member_profile_data( ‘field=cancer type’ ); ?>

    Or do I just need to insert the code without <?php..?>


    modemlooper
    Moderator

    @modemlooper

    When outside the members loop you have to pass it a user id.

    bp_get_profile_field_data( array( ‘field’ => ‘cancer type’, ‘user_id’ => bp_displayed_user_id() ) );


    ebraxton30
    Participant

    @ebraxton30

    I’m still not getting something right.  Here is how it is showing up…

    Members

    What do you mean by “outside the members loop?”  I’m adding this code to
    members/members-loop.php

    Here is how I added it. I’m sorry if this seems like a stupid question…I just really need to get this working and usually can figure this stuff out..

    http://pastie.org/5743946

     

     


    modemlooper
    Moderator

    @modemlooper

    ahh you need php tags. when you cut and paste you may need to retype single quotes.

     

    `<?php bp_member_profile_data( 'field=cancer type' ); ?>`

    ebraxton30
    Participant

    @ebraxton30

    I’m confused.  The earlier code is supposed to be used outside the member loop and this most recent code is supposed to be used in the member loop?

    I’ve inserted the most recent code and replaced the single quotes.  Nothing is showing up.  I just can’t seem to figure out why?  Here is my latest code in the member-loop.php

    http://pastie.org/5744477


    danbpfr
    Participant

    @chouf1

    Hi @ebraxton30,

    maybe try with this:

    <code>$current_user = wp_get_current_user();
    $current_user_id = $current_user->ID;

    bp_profile_field_data( array(‘user_id’=>get_the_author_meta(‘ID’),’field’=>’cancer type’));</code>


    ebraxton30
    Participant

    @ebraxton30

    That did not work, either.  Can someone please offer a solution?


    valuser
    Participant

    @valuser

    Here it is see http://pastebin.com/qLe9jXi6

    Mods would you be so kind as to put the pastebin link in the first post and delete the others.

    Apologies for the mess!


    ebraxton30
    Participant

    @ebraxton30

    No. it blanked out the screen.


    modemlooper
    Moderator

    @modemlooper

    The example may have broke and needs a refresh, try this:

    echo bp_member_profile_data( ‘field=Name’, bp_get_member_user_id() );


    danbpfr
    Participant

    @chouf1

    tried on /groups/single/members.php 1.6.3

    none of the solutions are working !


    ebraxton30
    Participant

    @ebraxton30

    That didn’t work either.  I just am stumped.


    modemlooper
    Moderator

    @modemlooper

    Works for me. Make sure you are writing the field name exactly as it is. name does not equal Name.


    danbpfr
    Participant

    @chouf1

    Is working on members list page but not on group members list page.
    To get a profile field value on the group member page (BP 1.6.3 tested), use this:

    <code><?php echo xprofile_get_field_data( ‘the_field_name‘ , bp_get_group_member_id() ); ?></code>

    Take care, the the_field_name is case sensitive.


    Danny Albeck
    Participant

    @dalbeck

    That worked like a charm! Now I have a question.. this is my code:

    Belt Level: echo xprofile_get_field_data(‘Belt Level’ , bp_get_group_member_id() );

    I have in this profile drop down field about 10 choices. Is it possible to somehow have this output assign a dynamic class or id pending on what your Belt Level is? I want to display this a color block with some css rather then just text on the screen.

    Thanks!


    ebraxton30
    Participant

    @ebraxton30

    I finally figured this out.  I am using Gravity Forms user registration plugin to work with my Buddypress theme.  My field names varied slightly between the custom profile field name and what I put on the user registration form.  I realized that I must use field name as it is entered in the WordPress Custom Profile Field.

    I do have one question…I would like to display the field name as well as what was entered in that field.  For example, this site is a cancer site and users will enter their type of cancer.  I would like it to read “Type of Cancer: Breast” rather than “Breast”

    Any suggestions?

Viewing 17 replies - 1 through 17 (of 17 total)
  • The topic ‘Adding custom profile fields to Member Profile’ is closed to new replies.
Skip to toolbar