Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change “Search anything…”

  • I’d like to make “Search anything…” more accurate.

    ie. “Search Members…”, “Search Groups…”, “Search Group Forums…”

    Is there an easy way to do this without hacking core?

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

  • Virtuali
    Participant

    @gunju2221

    This is what you want to change:

    `if ( !empty( $_POST ) && __( ‘Search anything…’, ‘buddypress’ )` in your theme’s ajax.php

    @gunju2221 Thanks, I saw that, but as far as I can tell, that’s for the hint text if searching using ajax (?)

    What I’ve done is replaced the appropriate strings in :

    bp-blogs/bp-blogs-templatetags.php
    bp-core/bp-core-templatetags.php
    bp-forums/bp-forums-templatetags.php
    bp-groups/bp-groups-templatetags.php

    which appears to have done the trick. Searches are working fine, as is the hint text.

    Let me know if you foresee any problem with this!


    r-a-y
    Keymaster

    @r-a-y

    Awesome, thanks @r-a-y .

    For anyone reading this thread, definitely do as suggested above, not as I did, which led to some unforseen complications.


    cezar
    Participant

    @cezar

    the language file has only one instance of “Search anything” so you can’t have a different message in the search boxes. how did you do it?


    valuser
    Participant

    @valuser

    Could @aljuk elaborate on the unforseen complications that arose from replacing the appropriate strings in bp-blogs/bp-blogs-templatetags.php etc. ?

    @cezar – I didn’t, for the precise reason you mentioned.

    @valuser – it broke the search on those directories.

    Changing it for certain other plugins that make use of search (Buddyvents, Global Forums) has been successful, and I did that by straightforward hacking those plugins.

    @cezar “the language file has only one instance of “Search anything” so you can’t have a different message in the search boxes. how did you do it?”

    Anyone found a workaround for this?

    ok I’ve made something really fast for you….

    0.1 place this function into your functions file at the end of the closing php tag ” ?> ” !

    `
    <?php
    function uloga_directory_search_form( $directory ) {
    global $bp;
    $form_id = ‘search-‘ . $directory . ‘-form’;
    $input_id = $directory . ‘_sarch’;
    $submit_id = $directory . ‘_search_submit’;

    $search_value = __( ‘Search ‘ . $directory, ‘buddypress’ );
    if ( !empty( $_REQUEST ) )
    $search_value = $_REQUEST;

    ?>
    <form action="" method="get" id="”>

    <input type="submit" id="” name=”groups_search_submit” value=”” />

    <?php
    }
    ?>

    `

    0.2 now you have to change the bp_directory_members_search_form() function with uloga_directory_search_form( $directory ) ,replace $directory for example with “Members”
    or “Groups” ,etc.

    p.s i mean you have to replace bp_directory_members_search_form() with the new function in your theme directory files.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to change “Search anything…”’ is closed to new replies.
Skip to toolbar