Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] adding xprofile fields to members directory list items


  • rgrober
    Participant

    @rgrober

    I’ve copied members-loop.php into my child theme (child theme > buddypress > members > members-loop.php).

    As instructed by the comments in this file, I added bp_member_profile_data( ‘field=Phone’ ); directly under the comments. However, the profile field doesn’t show up on the members directory page.

    Is there a crucial step I’m missing? Am I going about this the wrong way?

    Any help is greatly, greatly appreciated.

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

  • danbp
    Moderator

    @danbp

    To do that you need the xprofile field ID and the user ID.

    Here an example to show a profile fied containing a fax number. The filed is called Fax (case sensitive).

    Add this function to your child theme’s functions.php or better, into bp-custom.php

    function my_directory() {	
    if ( bp_is_active( 'xprofile' ) )
    
    	if ( $memberfax = xprofile_get_field_data( 'Fax', bp_get_member_user_id() ) ) :
    		echo '<br/><div class="Fax">';		
    		echo $memberfax;
    		echo '</div>';
    	endif;	
    
    }
    add_filter ( 'bp_directory_members_item', 'my_directory' ); 

    rgrober
    Participant

    @rgrober

    @danbp, I can’t even explain how thankful I am for your quick responses.

    This is working great. Thanks again.


    danbp
    Moderator

    @danbp

    You’re welcome !


    rgrober
    Participant

    @rgrober

    One last question. I appreciate your patience, as I am definitely nascent when it comes to this.

    The profile field I’m trying to display is a series of checkboxes. When I implement your code, the page is displaying “Array” for the field data.

    Can you direct me to a resource or method to allow checkbox fields to be displayed?

    Thank you again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] adding xprofile fields to members directory list items’ is closed to new replies.
Skip to toolbar