Mentions: for pre-cached result, use displayname if profile sync is enabled.

This should cut down on numbers of SQL queries made in certain
situations where a user on a site has many friends (whose user details
are not in WP’s object cache).

See #5950

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9101 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Mentions: don't prime mention results if the site/user has many users/friends.

Sites with huge amounts of users (and therefore probably many potential
friendships) can cause the primed result generation to be slow due to
the number of potential user name lookups/queries made.

Multisite has a function to help us decide if it’s a large network, but
it’s not available for regular WordPress, so we also check the logged
in user’s total friend count. (150 is Dunbar's number.)

In conjunction with the previous commit, this change should help make
the pre-cached result generation more performant.

Fixes #5950. Props imath for original patch.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9102 cdf35c40-ae34-48e0-9cc9-0c9da1808c22