Created
May 7, 2021 12:36
-
-
Save contemplate/90d66f44c2f254ef8bd5d20c1c03cfc1 to your computer and use it in GitHub Desktop.
Buddypress: Expand autocomplete mentions list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//turn on @mentions for all users | |
define( 'BP_MESSAGES_AUTOCOMPLETE_ALL', true ); | |
/*---- Expand Auto Complete -------*/ | |
//https://github.com/buddypress/BuddyPress/blob/fe47890c1ab7e2cb24c005f1c35fb9c6c8c8ab7c/src/bp-core/classes/class-bp-members-suggestions.php#L85 | |
function bp_filter_buddypress_auto_complete( $args ) { | |
$args['per_page'] = 100; | |
// $args['populate_extras'] = true; | |
//$args['search_terms'] = 'some term'; | |
$args['search_wildcard'] = 'both'; | |
//possible exclude non-members | |
return $args; | |
} | |
add_filter( 'bp_members_suggestions_query_args', 'bp_filter_buddypress_auto_complete' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add above code to your bp-custom.php list
Also manually edit JS limit to 100:
https://github.com/buddypress/buddypress/blob/bbf1de1201e46ad2b05065185c7a54a9f9a4a858/src/bp-activity/js/mentions.js#L34
Buddypress: buddypress/src/bp-activity/js/mentions.js
Buddyboss: buddyboss-platform/bp-core/js/mentions.js
Add CSS to child theme style.css:
.atwho-view ul {
max-height: 300px;
overflow-y: scroll;
}