BuddyDev

Search

Display Members Directory as list

  • Participant
    Level: Enlightened
    Posts: 38
    Keith on #12746

    How can I display members as a list with certain xprofile fields in the community builder theme? I would prefer a list rather than a grid.

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

    Hi Keith,
    I am sorry but the list layout is not available as part of 1.x.

    We have it available in 2.0
    https://i.imgur.com/ZlmNPRU.png

    But that will be atleast 2-3 weeks from now when we release it.

    In the current version, if you select the list layout, It will simply change the grid to 1 column per row.

    Adding profile fields is easy. There are 2 ways to do it.

    1. By overriding the member list template. It gives you more control.
    2. By putting the code in functions.php (a little bit less flexible).

    Which approach will you like to use?

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 38
    Keith on #12765

    How would I override the member list template? Do I copy the member-list template to my child theme and make the changes there? What about the CSS?

  • Participant
    Level: Master
    Posts: 413
    Venutius on #12767

    Hi Keith,

    While you are waiting for Brajesh to get back to you, you might like to take a look at my simple page n over-riding the BP template files. hope it helps.

    http://buddyuser.com/buddypress-customisation-tips

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

    Hi George,
    Thank you.
    You have a very informative article there and I am sure it will help many people.

    @ Keith,

    In this case, you can copy community-builder/buddypress/members/members-list.php to your child theme/buddypress/members/members-list.php

    and then we can use the following code to show a field in the loop.

    
    
    bp_member_profile_data('field=About'); // About is the name of field, you should change it.
    
    

    Or you can also use the following

    
    echo xprofile_get_field_data( 'About', bp_get_member_user_id(), 'comma' );
    
    

    If you are using the second style, you may want to use field id instead of field name for better efficiency.

    
    echo xprofile_get_field_data( 2, bp_get_member_user_id(), 'comma' );
    
    

    Hope that helps.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved