Remove search boxes for non logged in users

I do not want visitors searching my site if they are not logged in see image below for both search boxes I want to remove.

Also if you can provide detail how to get this done.

Another thing is I want to of course place this file somewhere outside of buddypress. So help on where to place the file (whatever or wherever that file is), will also be appreciated.

So to avoid any delays of course if I can get help on this…

1. In the images below those search boxes should not be available to logged out users.

2. Detail instructions on which file to edit, code to use and where to place the file once I am done editing it.

I did what I thought was correct procedures but it did not work out for me.

bp-daily 3.9.6

buddypress 1.2.7