Default Search by Alphabetical order

BP Profile Search › Default Search by Alphabetical order

  • Author
    Post
  • #4577 Reply
    Erik
    Guest

    Hi, Andrea, first of all your plugin its great!
    Im trying to set the Alphabetical order search as default(in template and widget), and remove the option to change that (active,newest,alphabetical). So when the user start a search allways find other in Alphabetical order and not just the active users for example. And remove the advanced search . I can´t find the correct place with the sql “filter” or the “option” template part.
    Thanks in advance!
    IMG-search

    #4578 Reply
    andrea
    Plugin Author

    Hi Erik,

    You can do the following:

    1. To set the alphabetical order, modify

    /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/members-loop.php

    replacing line 27:

    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>

    with:

    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ). '&type=alphabetical' ) ) : ?>

    2. To remove the order selection, modify

    /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/index.php

    removing lines 76 through 95:

    <li id="members-order-select" class="last filter">
    ...
    ...
    </li>

    3. To remove the BP Profile Search form from the Members directory, edit that form and select Add to Directory: No

    Please let me know if that works for you!

    #4581 Reply
    erik
    Guest

    Its work like a charm !!
    It took me a little to find the corret php files because im using a diferent template, so the files that you point me are in a diferent place.

    Thanks Andrea!!

    #4593 Reply
    andrea
    Plugin Author

    You are welcome, I’m glad you succeeded!

    #11263 Reply
    mitsuhiro
    Guest

    I don’t need Alphabetical order.
    So, I tried to remove

    <li id=”members-order-select” class=”last filter”>
    …
    …
    </li>

    but it doesn’t work.
    How to remove Alphabetical order?
    Please let me know.

    #11264 Reply
    andrea
    Plugin Author

    Hi mitsuhiro,

    Two questions: What theme are you using? And what BuddyPress Template Pack, Legacy or Nouveau?

    #11265 Reply
    mitsuhiro
    Guest

    Thank you, andrea.
    I use Nouveau.
    And, I could erase the alphabetical sort.

    I went to

    buddypress\bp-templates\bp-nouveau\includes\members\functions.php

    and put this code

    function mitsuh_remove_alphabetical( $filters, $context ) {
    
    	unset( $filters['alphabetical'] );
    
    	return $filters;
    }
    add_filter('bp_nouveau_get_members_filters', 'mitsuh_remove_alphabetical', 20, 2 );

    I have known this code in BuddyPress Forum.

    https://buddypress.org/support/topic/erase-alphabetical-sort/

    By the way,
    I didn’t know, there are two template packs, Legacy and Nouveau.
    What are the differences in the two?

    #11266 Reply
    andrea
    Plugin Author

    Hi mitsuhiro,

    Glad you found a suitable solution!

    The differences between the two template packs are well explained here:

    https://bpdevel.wordpress.com/2017/04/12/bonjour-nouveau-an-introduction-to-the-next-template-packs/

    #11267 Reply
    mitsuhiro
    Guest

    Thank you!
    I read it and understand.
    I like BuddyPress much more.

    #11338 Reply
    João Vítor
    Guest

    Andrea, I changed the code in /wp-content/plugins/buddypress/bp-templates/bp-nouveau/buddypress/members/members-loop.php to be alphabetical order by default as you said, but to no avail. I use the nouveau version.

    #11342 Reply
    andrea
    Plugin Author

    Hi João Vítor,

    Could you post the change you made? I mean the modified line, plus a few lines before and after it.

    #11344 Reply
    João Vítor
    Guest

    <?php if ( bp_get_current_member_type() ) : ?>
    <p class=”current-member-type”><?php bp_current_member_type_message(); ?></p>
    <?php endif; ?>

    <?php if ( bp_has_members( bp_ajax_querystring( ‘members’ ). ‘&type=alphabetical’ ) ) : ?>

    <?php bp_nouveau_pagination( ‘top’ ); ?>

    #11347 Reply
    andrea
    Plugin Author

    Hi João Vítor,

    Your change looks fine to me.

    If you wish, I can take a look at your test site. I’ll need a WP admin access, and you can share it privately using my Contact page.

    #11481 Reply
    Bula
    Guest

    Hey!
    I want to thank you for helping us.
    I faced this problem too. Changed the code, but nothing changed for me.

    #11483 Reply
    andrea
    Plugin Author

    Hi Bula,

    It’s hard to guess what’s going wrong without taking a look.

    If you agree, you could send me a WP admin access to your test site. You can share it privately using my Contact page.

    #11489 Reply
    Bula
    Guest

    Hi, Andrea!
    Thanks for the answer! I started to understand a little about filters, but after activating your filter search function, it stopped working for me.
    I sent you access!
    Thank you again!

    #11491 Reply
    andrea
    Plugin Author

    Hi Bula,

    I got your message, thank you.

    I’ll take a look at your site this weekend and I’ll get back to you.

    #11494 Reply
    Bula
    Guest

    Hi Andrea!
    Thank you, I will wait for your answer!

    #11735 Reply
    Yasmine
    Guest

    Hi Andrea!

    I also have the problem with the filters. I want to set the alphabetical as default and if possible remove the last active and last registered option. I did the steps that you suggested above, but it did not work for me.

    Can you help me, please?

    Thank you.

    #11737 Reply
    andrea
    Plugin Author

    Hi Yasmine,

    Which theme are you using? And which BuddyPress Template Pack, Legacy or Nouveau?

    #11739 Reply
    Yasmine
    Guest

    Hello Andrea,

    I’m using the Kleo Theme and the Nouveau Template.

    #11741 Reply
    andrea
    Plugin Author

    Hello Yasmine,

    I think Kleo use their own BuddyPress templates, so you should apply the changes to their templates, not to the BuddyPress defaults.

    I don’t have a copy of Kleo, so if you aren’t able to make the changes yourself I suggest you ask Kleo support for advice.

Reply to: Default Search by Alphabetical order
My Information