BP Profile Search › Default Search by Alphabetical order
-
AuthorPost
-
Erik
GuestHi, 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-searchandrea
Plugin AuthorHi 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!
erik
GuestIts 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!!
andrea
Plugin AuthorYou are welcome, I’m glad you succeeded!
mitsuhiro
GuestI 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.andrea
Plugin AuthorHi mitsuhiro,
Two questions: What theme are you using? And what BuddyPress Template Pack, Legacy or Nouveau?
mitsuhiro
GuestThank 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?andrea
Plugin AuthorHi 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/
mitsuhiro
GuestThank you!
I read it and understand.
I like BuddyPress much more.João Vítor
GuestAndrea, 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.
andrea
Plugin AuthorHi João Vítor,
Could you post the change you made? I mean the modified line, plus a few lines before and after it.
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’ ); ?>
andrea
Plugin AuthorHi 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.
Bula
GuestHey!
I want to thank you for helping us.
I faced this problem too. Changed the code, but nothing changed for me.andrea
Plugin AuthorHi 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.
Bula
GuestHi, 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!andrea
Plugin AuthorHi Bula,
I got your message, thank you.
I’ll take a look at your site this weekend and I’ll get back to you.
Bula
GuestHi Andrea!
Thank you, I will wait for your answer!Yasmine
GuestHi 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.
andrea
Plugin AuthorHi Yasmine,
Which theme are you using? And which BuddyPress Template Pack, Legacy or Nouveau?
Yasmine
GuestHello Andrea,
I’m using the Kleo Theme and the Nouveau Template.
andrea
Plugin AuthorHello 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.
-
AuthorPost