Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Add profile fields to Group Members loop


  • maikunari
    Participant

    @maikunari

    Is there any way to get profile fields to work on the groups/single/members.php template?

    I have a custom profile field named “profile”.

    I’ve tried adding:`<?php if ( bp_get_member_profile_data( ‘field=Profile’ ) ) : ?>
    <?php bp_member_profile_data( ‘field=Profile’ ); ?>
    <?php endif; ?>`

    This works in members/members-loop.php but doesn’t return anything in the groups/single/members.php template.

    Any help would be greatly appreciated.

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

  • bp-help
    Participant

    @bphelp

    @maikunari
    Looks like you forgot to echo it. Try this!

    
    <?php if ( bp_get_member_profile_data( 'field=Profile' ) ) : ?>
         <?php echo bp_member_profile_data( 'field=Profile' ); ?>
     <?php endif; ?>
    

    shanebp
    Moderator

    @shanebp

    Use bp_get_group_member_id() and pass the id to xprofile_get_field_data(…)

    If you can’t figure it out and/or you want to honor field visibility settings,
    there is a premium plugin available: BuddyProfileData


    maikunari
    Participant

    @maikunari

    @bphelp Thanks for the answer, but that doesn’t seem to be it 🙁

    I tried <?php echo bp_member_profile_data( 'field=Profile:' ); ?> but no dice.
    Also it seems to work fine without echoing it on members/members-loop.php.

    It may be that the function only works inside the members loop, but I’m not sure?


    maikunari
    Participant

    @maikunari

    @shanebp Thanks for the tip, that may be just what I need!


    maikunari
    Participant

    @maikunari

    Just posting back with the solution in case it helps anyone else. This function will do it:
    xprofile_get_field_data('Profile',$u_id);

    In my case it’ll be:

    <?php if ( xprofile_get_field_data( 'Profile', $user_ID ) ) : ?>
         <?php echo xprofile_get_field_data( 'Profile', $user_ID ); ?>
    <?php endif; ?>

    Thanks to chifliiiii on WordPress Answers and to @shanebp.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Add profile fields to Group Members loop’ is closed to new replies.
Skip to toolbar