Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting profile data into the members loop

  • @jmetzger631

    Participant

    I’m having a hard time figuring out how I can get some extra profiles fields that are in wp_usermeta into the members loop.

    I’m trying to get the value of “profile_company”

    I’ve seen a lot of posts saying that this should work. But it doesn’t.

    `

    `

    I also don’t have any problem getting this field on my single profile page using this

    profile_company; ?>

    Any help would be greatly appreciated. Thanks in advance 🙂

    Oh I’m also using Buddypress 1.7

Viewing 4 replies - 1 through 4 (of 4 total)
  • @jmetzger631

    Participant

    Okay so whats the deal with the code tags not working at all on here?

    @bphelp

    Participant

    @jmetzger631 I have had the same problem here. The best thing to do until its fixed is put the code on http://www.pastebin.com then put the link here that contains the code.

    @jmetzger631

    Participant

    Thanks.

    Here it is.

    http://pastebin.com/6Z6eawmz

    @chouf1

    Participant

    hi @jmetzger631

    Assuming you used xprofile component to do so.

    You have to enter the correct profile field name. This means the name, in fact the field title, you entered when you create the profile field.

    Probably “Company” or “Your company” or something readable for your public.

    In BP 1.7/bp-default/members/members-loop.php:67 there is an example who explains this too.

    /***
    * If you want to show specific profile fields here you can,
    * but it’ll add an extra query for each member in the loop
    * (only one regardless of the number of fields you show):
    *
    * bp_member_profile_data( ‘field=the field name’ );
    */

    You can also create a function to insert a do_action in the members-loop.

    In the function, intented to work outside of the profile loop, you need the user id and the xprofile data

    $user_id=bp_get_member_user_id();
    $anything = xprofile_get_field_data (‘the_field_name’, $user_id);
    echo $anything;

    add_action ( ‘a_name_of_your_choice’, ‘your_function_name’)

    and somewhere in the loop, do_action( ‘a_name_of_your_choice’ )

     

     

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Getting profile data into the members loop’ is closed to new replies.
Skip to toolbar