Skip to content

Instantly share code, notes, and snippets.

@contemplate
Created May 7, 2021 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save contemplate/90d66f44c2f254ef8bd5d20c1c03cfc1 to your computer and use it in GitHub Desktop.
Save contemplate/90d66f44c2f254ef8bd5d20c1c03cfc1 to your computer and use it in GitHub Desktop.
Buddypress: Expand autocomplete mentions list
//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' );
@contemplate
Copy link
Author

contemplate commented May 7, 2021

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment