Skip to:

Autocomplete all users on the compose screen

  • Avatar of r-a-y


    By default, on the messages compose screen, autocomplete only works for friends; with the following code snippet, autocomplete on the messages compose screen works for all users.

    Copy this in your theme’s functions.php file:

    This is via a request from David Lewis.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thanks! I’ll try that. I did get it working but I had to duplicate functions and hack the core… etc. Such are my limited skills. Then my “working” fix stopped working mysteriously a few days later. Argh. Anyway… thanks. I agree that this is plugin territory and the ticket should probably be closed.

    Thanks! Works! This is actually basically what I had done but you accomplished it in a much better way!!! Thank you thank you thank you!!! Halifax Regional Search and Rescue thanks you :)

    And by the way… I found out why my attempt “broke”. It actually didn’t break. Not exactly. I had been trying to send test messages to myself at a second member account with a BuddyPress profile name of “David Lewis (test)”. And it would always fail. I realized what was probably happening was the BuddyPress was thinking that “test” was the username… but it wasn’t. The autocomplete for that member was showing up as “David Lewis (test) (davidlewistest)”. “davidlewistest” was the username. I tried changing my BuddyPress name on that account to “David Lewis Test” and now it works.

    Your code had the same issue of course. Not worried about it though. Who puts parenthesis in their BuddyPress name! Still… I think maybe I came across a REAL “bug” this time :D “Messages fail to send if members BuddyPress name contains parenthesis”.

    Anyway… so either way worked (mine or yours) but I’m very grateful for a solution that doesn’t require me to touch the core.

    Avatar of CarolineElisa


    Thank you so much @r-a-y , worked for me too!

    Now I just need to get the autocomplete to stop pulling in random html… Found this but I think as it’s for an older version of Buddypress I can’t get it to work for me.

    These people are having the same problem too.

    Avatar of ultimateuser



    Great I got this working now. Is it correct to say that this only works for all users when Friends Component Setup is enabled?

    Id love to have Friends disabled and still have autocomplete for all users working…

    Avatar of r-a-y


    The code should work without friends enabled, though I haven’t tested thoroughly.

    I’m guessing you’re using the BP Followers plugin?

    Avatar of chrisjscott


    Awesome – thanks for this!

    Can someone make a trac enhancement ticket for this, I think there’s some merit to changing the behaviour in core

    Avatar of Nm


    I’ve seen that autocomplete feature, sure would be nice in general Search of members, groups, and blogs.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.