Skip to:

Is it possible to override bp-core-templatetags functions such as bp_directory_members_search_form

  • Dear all,

    I would like to customize the HTML that is returned by bp_directory_members_search_form() in bp-core-templatetags.php. I seem to kill the app when I attempt to override the function in my functions.php. I’d be grateful for any advice on where to override this function, or is altering the core code the only current option for customization (I’d rather not complicate my ability to update)?


Viewing 5 replies - 1 through 5 (of 5 total)
  • Profile photo of Boone Gorges
    Boone Gorges


    Yeah, those functions can’t be simply overridden (like the functions in wp-includes/pluggable.php).

    Your best bet is to do the following:
    1) Copy the entire function you want to replace yo your functions.php, and change the function name (to something like custom_directory_members_search_form() )
    2) Make sure that the template file that calls the template tag (I think it’s members-loop.php, though I’m not in front of my computer at the moment) exists in your child theme. Replace the reference to the original function in that template file to your newly created function name. Then you can customize to your heart’s content.

    Profile photo of cezar


    Hi Boone,
    did this to change the text inside the search box for bp_directory_members_search_form but after doing it it broke the ajax sorting (alphabetical, active, newly registered.)
    any thoughts on that?


    Profile photo of larceniii


    I’m doing something very similar, and I can see how the Order By dropdown could break easily.
    I doubt after a year of no-replies I can expect much help either…

    Profile photo of Roger Coathup
    Roger Coathup


    These forums don’t notify people of follow up comments — so, no surprise that Boone didn’t pick up on a further question several months later.

    You can try the @username approach in your comment to notify them

    Profile photo of jashwant


    I added class="form-control" to input and btn class to submit button.

    Hope this helps.

    function cb_bp_directory_members_search_form() {
      $search_form_html = '<form action="" method="get" id="search-members-form">
        <label><input type="text" class="form-control" name="s" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
        <input type="submit" id="members_search_submit" class="btn"  name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
      return $search_form_html;
    add_filter('bp_directory_members_search_form', 'cb_bp_directory_members_search_form');
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Is it possible to override bp-core-templatetags functions such as bp_directory_members_search_form’ is closed to new replies.
Skip to toolbar