Login To Search MOD
Note: If you decide to make these changes to your own board, please make sure you backup search.php and language/en/common.php before proceeding; Works on phpBB 3.3.8. Please proceed with caution and due diligence.
In a default phpBB installation, if a guest is not allowed to search the board (with a permission setting that does not give them such access) and they attempt to use search.php, they are told that they cannot use the search system as opposed to being given a login screen. This is different from when guests cannot view the memberlist/profiles for some reason, but can be changed in search.php by replacing:
With:
And in language/en/common.php
Finding:
And adding the following after it:
It is better than saying "Sorry but you are not permitted to use the search system." to unregistered users imho.
[Edited: Code edited a bit to make it a bit more organized and hopefully human readable. What it does is unchanged and I have tested it with the edit.]
In a default phpBB installation, if a guest is not allowed to search the board (with a permission setting that does not give them such access) and they attempt to use search.php, they are told that they cannot use the search system as opposed to being given a login screen. This is different from when guests cannot view the memberlist/profiles for some reason, but can be changed in search.php by replacing:
Code: Select all
// Is user able to search? Has search been disabled?
if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search'])
{
$template->assign_var('S_NO_SEARCH', true);
trigger_error('NO_SEARCH');
}
Code: Select all
// Is user able to search? Has search been disabled?
if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search'])
{
// Is the user logged in but unable to search? If so, they will get an error message.
if ($user->data['user_id'] != ANONYMOUS)
{
$template->assign_var('S_NO_SEARCH', true);
trigger_error('NO_SEARCH');
}
// If the user is a guest and cannot search, they will recieve a login page.
login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_SEARCH']));
}
Finding:
Code: Select all
'LOGIN_EXPLAIN_VIEWONLINE' => 'In order to view the online list you have to be registered and logged in.',
And adding the following after it:
Code: Select all
'LOGIN_EXPLAIN_SEARCH' => 'In order to search the board you have to be registered and logged in.',
It is better than saying "Sorry but you are not permitted to use the search system." to unregistered users imho.
[Edited: Code edited a bit to make it a bit more organized and hopefully human readable. What it does is unchanged and I have tested it with the edit.]