I have a section of my drupal website that I only want displayed to users that are logged in. So if they click on "My Page" link and the user is not logged in it should redirect them to a login screen. I have attempted to complete this task by using the following code.
<?php
if (!user_is_logged_in()) drupal_goto('user/login'); ?>
This doesn't seem to throw any coding errors but none of my links such as register, login etc work. I get an error that I have a redirect loop that will never complete. I cannot seem to find a good solution for completing this.