Only friends able to comment on profiles

Hello there -

I'm working on eliminating places where spammers can post inappropriate messages. I found the bit of code in this post really helpful in removing the ability to leave comments in public groups if you are not a member.

https://premium.wpmudev.org/forums/topic/buddypress-group-comment-permissions-help-please

Now, I'd like to remove the ability to comment on members' profiles if they are not your friend.

Ideas?

Thanks!
~