You’ll probably want to look at the bp_legacy_theme_ajax_messages_autocomplete_results()
function and roll your own version.
Something like:
// Remove the default AJAX autocomplete hook.
remove_action( 'wp_ajax_messages_autocomplete_results', 'bp_legacy_theme_ajax_messages_autocomplete_results' );
// Add our own.
add_action( 'wp_ajax_messages_autocomplete_results', 'my_messages_autocomplete_results' );
function my_messages_autocomplete_results() {
// YOUR CUSTOM AJAX OUTPUT HERE
}
Thanks! That worked.
One small problem that remains, is that I still have parenthesis wrapped around $user->name
Here’s a chunk of the code:
printf( '<span id="%s" href="#"></span><img src="%s" style="width: 15px"> %s (%s)' . "\n",
esc_attr( 'link-' . $user->ID ),
esc_url( $user->image ),
esc_html( ),
esc_html( $user->ID )
I deleted $user->name from the 3rd line, but if I delete the parenthesis, or the entire line, then the function stops working.
Do you know how I can get the parenthesis out of there?
Have you tried just removing the parenthesis in the <span>
string?
That worked. Thanks very much!
Correction: What I meant was, I didn’t find any parentheses in the span tag, but I removed them from the %s, and it display the name without parentheses, but it crippled the function; without those parentheses, I click on a name from the list and the name gets printed with html code wrapped around it.
Not a big deal – but let me know if you have any other suggestions. I will mess around with it some more and post back if I get it working.
Hello, did you manage to find solution to this issue?