if you don’t have forum visibility set, and if the forum isn’t ‘private’ (but protected by a group), then the url in the visibility settings will work ie you can set up a login page and re-direct to that.
Thread Starter
jkisha
(@jkisha)
Thanks so much for your speedy reply. That worked like a charm!
Now, if only there was a plugin that would hold the link and redirect back to the appropriate forum after login. But that’s a whole other issue.
Again, I thank you. Great plugin.
I’ve got this code in a saved file, that I might use later on.
function restrict_access_if_logged_out(){
if (!is_user_logged_in() && substr( $_SERVER['REQUEST_URI'], 0, 8 ) === "/forums/" ) {
$redirect = home_url() . '/wp-login.php?redirect_to=' . urlencode( $_SERVER['REQUEST_URI'] ); ;
wp_redirect( $redirect );
exit;
}
}
add_action( 'wp', 'restrict_access_if_logged_out', 3 );
Thread Starter
jkisha
(@jkisha)
Well I’m not much of a coder at all, so I’m sure can’t fully appreciate that code snippet, but I’m glad you’ve been thinking about it. I’ll jump for joy when I see the next update! 🙂
(Don’t mean to rush you. 🙂 )
Thanks again Robin.
I have a similar issue. I am following this:
For each restricted forum
Go in to Dashboard>forums and select the forum you wish to restrict.
Under the text you’ll see a box called ‘Forum Groups’ – select the group or groups you wish to allow to access this forum
If you wish to have a custom error message, you can set one here.
But I don’t see where the custom error message goes? My forums are public, restricted to groups, and Forum Visibility is OFF, but just in case someone does see the page that isn’t supposed to, where do I put in the URL to redirect them?