I tried the filter way you propose by adding a function and action to bp-custom.php but I could not make it work. That is why I wrote this little guide.
Anyway, @shanebp is right, modifying core files is not the best practice. This is more like a last resource.