Hello,
Iâm sorry to say, but I believe this is an issue in rtMedia code.
This is the code in question:
That code bypasses the first check in Buddypresâ bp_friends_prime_mentions_results() function, and when that function completely runs for non logged in users, it will cause the issue of listing ALL users on any page for non-logged in users. This is a huge issue, on a site with over 60k users, this resulted in phpâs memory usage of over 300mB, and processing times of over 10 seconds.
While Iâd agree that Buddypress should probably have some protection in its code against this, ultimately the root cause of the issue is the rtMedia code linked above. Please fix it.
For anyone having this problem (and thatâs everyone using rtMedia plugin with Buddypresâ Friend Connections component), this is a simple fix you can add to your themeâs functions.php until rtMedia provides a fix for it.
function fix_rtmedia_loading_for_anon($load_mentions, $mentions_enabled) {
if ( get_current_user_id() == 0 ) {
return false;
}
return $load_mentions;
}
add_filter( âbp_activity_maybe_load_mentions_scriptsâ, âfix_rtmedia_loading_for_anonâ, 10002, 2 );