How to force login for restricted pages

I use the Groups plugin and have a Registered group set up for registered users. I've got several pages, courses (Learndash) and a forum (bbPress) that are restricted to registered users. Currently, when a logged out user visits those pages, the visitor is redirected to the homepage. I want the user redirected to the WP login page instead, and then redirected to the requested page after login.

I've tried adding the following to the top of header.php in my theme:

<?php if ( is_page( $PAGE_ID ) ) auth_redirect(); ?>

but it doesn't work. What's a good way to redirect logged out users to the WP login page? TIA.