For the benefit of anyone else, here’s what I did :
The original issue was that when a not-logged-in user clicks a link to the forums, they would be redirected to the home page. To the uninitiated, they might never figure out why that was and might assume the links are broken of the forums don’t exist. ??
1) Used the above modification to redirect to the login screen instead of the home page.
Change this :
wp_redirect( $logged_out_url );
to this :
wp_redirect( get_bloginfo( 'url' ).'/wp-login.php' );
As per the above caution, with the plugin is updated, this will be overwritten.
2) However, it’s still slightly odd to click a link to the forums and wind up at the login page instead of the forums with not explanation. So I also customized the blurb on the login page to say that you have to be logged in to participate in the forums. (like this : https://smallenvelop.com/add-custom-message-wordpress-login-page/)