Hi - I'm just trying out wpForo, which looks good, and we shall probably be using it.
There's one thing I need a bit of help with, though - I only want logged-in users to be able to access the forums. If a "Guest" tries to access the forum page ("/community"), they must see nothing at all, or maybe just a login page.
I can't see an easy option to do this in the plugin settings. I understand that Accesses are used to manage permissions on each forum, rather than for all forums.
My alternative is to protect the "community" page itself, so that only logged-in users can see it. Perhaps that's what I have to do - or is there a plugin setting that will do it?
Hi,
You can restrict accessfor guests by setting 'No Access' for 'Guest' usergroup.
Please check out this FAQ to better understand the forum access and user group connections: https://wpforo.com/community/faq/wordpress-user-roles-wpforo-usergroups-and-forum-accesses/#post-39664
The solution provided by another community member should also be helpful for you: https://wpforo.com/community/how-to-and-troubleshooting-2/how-to-hide-forum-for-guests/#post-103677
Thanks for that, and for the useful links.
My understanding is that I need to set "No Access" for "Guest" on every forum, and there is no single global setting for "Guests", to disallow all forums. I can see that this would work.
I think however I will try protecting the "/community" page, so that it can only be reached by logged-in users.
Just to add to this - I have been able to do what I needed, and block access to the forum for logged-out visitors. I used the theme customization feature - as follows (in brief):
- Create a wpforo directory in my theme folder
- Copy \wp-content\plugins\wpforo\themes\2022\index.php into my wpforo directory
- Add this code near the top of the copied file:
if (!is_user_logged_in()) { include __DIR__.'/my-login.php'; return; }
- Copy \wp-content\plugins\wpforo\themes\2022\index.php into my wpforo directory again, but naming it "my-login.php"
- Strip down "my-login.php" so that the only template it invokes is wpforo_template('login'), and remove the forum header / footer blocks.
I could have just made more changes to the original copy of index.php, but I wanted to keep the modifications there to a minimum. It will be easier to copy again if I ever need to.
Another update, in case it helps anyone else with this same need. I've cut down on the customisation and used as much of WPForo as possible.
So, I create a "wpforo" folder in my own WP theme directory. I add "index.php" to the "wpforo" folder, with this code, which overrides the WPF theme "index.php" file.
<?php // Exit if accessed directly if( ! defined( 'ABSPATH' ) ) exit; if (!is_user_logged_in()) { $this->current_object['template'] = 'login'; $this->settings->components['top_bar'] = false; $this->settings->components['footer'] = false; $this->settings->components['breadcrumb'] = false; } include $this->tpl->template_dir . '/index.php';