I was having this same problem and posted a lengthy comment about it in the trac ticket mentioned above ( http://trac.buddypress.org/ticket/2647 ), but in the meantime, I developed a workaround that works on my site and doesn’t require modifying any core files (and will fix the problem in any BP component, not just with friend request emails).
Just add the following function (a filter) to your theme’s functions.php file:
/**
* Intercept bp_core_catch_no_access() when nothing is set to enable smart login page redirects
* and prevent BP from just redirecting the user to the homepage
*
* <a href='http://buddypress.org/community/members/param/' rel='nofollow'>@param</a> string $found_template The result of locate_template() call
* <a href='http://buddypress.org/community/members/param/' rel='nofollow'>@param</a> mixed $templates Not sure what it's for, but it's generally bool false
*/
function yourtheme_load_template_filter( $found_template, $templates ) {
if ( ! $templates && empty( $found_template ) ) {
// just set it as default theme file so that file_exists() returns true
$found_template = get_stylesheet_directory() . '/index.php';
}
return $found_template;
}
add_filter( 'bp_located_template', 'yourtheme_load_template_filter', 11, 2 );
It’s not a good permanent solution, but I haven’t noticed it affecting anything else (including BP 404s) on my site, and it leaves your BP install happily untouched. If the issue is fixed in the future, of course, I would highly recommend removing this fix, but as far as I can tell, it’s harmless, and certainly makes your site far more usable.