Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add Profile Search Field to Member Directory results


  • partytrotter
    Participant

    @partytrotter

    Hello, so I have installed BP Profile Search, and I would like to display the results in the members directory (results of the search). Let me explain, let’s say I searched for people that put Montreal in their profile, it won’t display it when i do a search (it will only display their name). So I would like to know how I can make it display the city close to their name?

    Thanks a lot!

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

  • Henry
    Member

    @henrywright-1

    Open member-loop.php and you will see instructions on how to add custom profile fields such as Location. It is quite straightforward to do.


    partytrotter
    Participant

    @partytrotter

    @Henry thanks a lot for the help, but I’m really a beginner, I just opened members-loop.php and sincerely can’t find any instruction on how to add custom profile fields, care to explain?

    Thanks a lot again!


    bp-help
    Participant

    @bphelp

    @partytrotter
    See lines 61 through 69 in members-loop.php
    Between the opening and closing php tags you add code. For example:

    
    echo bp_member_profile_data('field=City');
    

    The instructions are commented between those lines as well.
    Just remember for it to show up you need to create a profile field in the dashboard named “City” and it is case sensitive so city is not the same as City.


    partytrotter
    Participant

    @partytrotter

    @bphelp, thanks a lot for the help, but I tried adding that line and it didn’t do much :S Here is what my code looks like without the line, where should I add it? Also, just to be sure I am modifying the right file, i took the members-loop.php in the folder of the current theme I am using, is that correct?

    <?php

    /**
    * BuddyPress – Members Loop
    *
    * Querystring is set via AJAX in _inc/ajax.php – bp_dtheme_object_filter()
    *
    * @package BuddyPress
    * @subpackage bp-default
    */

    ?>

    <?php do_action( ‘bp_before_members_loop’ ); ?>

    <?php if ( bp_has_members( bp_ajax_querystring( ‘members’ ) ) ) : ?>

    <div id=”pag-top” class=”pagination”>

    <div class=”pag-count” id=”member-dir-count-top”>

    <?php bp_members_pagination_count(); ?>

    </div>

    <div class=”pagination-links” id=”member-dir-pag-top”>

    <?php bp_members_pagination_links(); ?>

    </div>

    </div>

    <?php do_action( ‘bp_before_directory_members_list’ ); ?>

    <?php cc_get_displaymode(‘members’)?>

    <?php do_action( ‘bp_after_directory_members_list’ ); ?>

    <?php bp_member_hidden_fields(); ?>

    <div id=”pag-bottom” class=”pagination”>

    <div class=”pag-count” id=”member-dir-count-bottom”>

    <?php bp_members_pagination_count(); ?>

    </div>

    <div class=”pagination-links” id=”member-dir-pag-bottom”>

    <?php bp_members_pagination_links(); ?>

    </div>

    </div>

    <?php else: ?>

    <div id=”message” class=”info”>
    <p><?php _e( “Sorry, no members were found.”, ‘cc’ ); ?></p>
    </div>

    <?php endif; ?>

    <?php do_action( ‘bp_after_members_loop’ ); ?>


    bp-help
    Participant

    @bphelp

    try adding this above line 58 the do_action line:

    
    <div class="user-location"><?php echo bp_member_profile_data('field=City'); ?></div>
    

    As specified above you still need to make a profile field in the dashboard and the end user has to fill in that info before it will show up! I personally tested it and it works so make sure you place the code as I have instructed.


    wavedrop
    Participant

    @wavedrop

    I am using a plugin called “BP Profile Search”. I am a developer and would have no issues coding a custom page for whatever functionality I need, but I am using the plugin and it’s working great. #stadingOnShouldersOfGiants

    https://wordpress.org/plugins/bp-profile-search/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add Profile Search Field to Member Directory results’ is closed to new replies.
Skip to toolbar