Magento 1 : hide price for guest when price is 0

I want the price of some products on the site to be displayed only to users who have logged in
To do this, I want to say that if the price of the product was 0 and the user did not loged in, write the following text
Log in to view prices

I use the following code which only checks the login and displays the text for all users

echo '<span class="login_for_price"><strong>Login to See Price</strong></span><br>';