Mar 15, 2020 4:50 pm
Hi I'm just experimenting with setting up wpforo on a new site with a private forum.
While wpForo seems to hide topics and posts from non-logged in users, it would be nice if there was a setting to simply redirect anyone trying to access the forum who isn't logged in to the login page. (Easier user experience for members to work out that's what they've forgotten to do, and more secure that it doesn't show there is a valid forum board with that name)
Is this possible? If so, how do I do it? Thanks.
Β
3 Replies
Mar 16, 2020 1:12 pm
Hi @hill-seeker91,
Please put the following code in your current active theme functions.php file:
Β add_filter('wpforo_after_init_current_object', function ($current_object){ if( in_array($current_object['template'], array('forum', 'topic')) ){ if( !WPF()->current_userid && !WPF()->perm->forum_can('vf', $current_object['forumid']) ){ wp_redirect( wpforo_login_url() ); exit(); } } return $current_object; });