The Search is On

I’ve been trying to figure out how to get private messaging to work in BuddyPress, so that it actually makes sense. I’ve got users from all over Europe who want to connect with each other, and they don’t want to have to first navigate to users list, search for user, click on user, send private message.
What I would like for my users to be able to do, is click on compose, and start entering a user name, and that gets autocompleted. Seems fair enough, right. Seems like it should be standard, or at least easy to turn on.
I understand the security risks here. But I have a members only site. No one from outside is going to have access to messaging. They have to get through a couple of other hurdles first.

I first searched Google on variations of “buddypress autocomplete” and “buddypress messages send to any user autocomplete”.

BuddyDev Ahoi!

There, I found a couple of interesting articles. One by Brajesh Singh, who develops a lot of great stuff and answers questions with real heart, on BuddyDev.

He has some interesting tutorials about how to add autocomplete for mentions.

Unfortunately, this is not what I needed.

How in the World…

…did I figure this out?

I found it under the filters and constants reference of the BuddyPress Codex. 

So, here’s the solution:


Add the above code to your wp-config.php or bp-custom.php file

Please be wary on open sites. See this direct quote from the reference page:

If you do allow this please consider that it allows possible spamming of you members , this is why if only friends can PM it’s by consent.

In Conclusion

So, the take-home here has got to be, something like RTFM.

The only way for me to have known this, was to have read through the whole codex already, and have memorized it. Or perhaps my own searching ability needs to be improved.

Hope this helps someone else besides me. Post a comment, if it saved you some time.

BuddyPress Codex