News:

Wondering if this will always be free?  See why free is better.

Main Menu

Disabling Search for Guest

Started by Dr. Beast, December 13, 2013, 02:42:34 AM

Previous topic - Next topic

Dr. Beast

Is it possible to remove search form on home page for guests because when guest uses search everytime is generated error in error log:

http://domain.com/index.php?action=search2 [nofollow]
8: Undefined index: title
File: /path/Themes/default/Login.template.php (body_above sub template - eval?)
Line: 422

http://domain.com/index.php?action=search2 [nofollow]
8: Undefined index: href
File: /path/Themes/default/Login.template.php (body_above sub template - eval?)
Line: 421

Storman™

Go into Administration Center --> Members --> Permissions --> General Permissions

Find "Guests" and click on Modify.

Under "Use basic forum functionality", look for "Search for posts and topics". Untick that option and click on the "Save changes" button.

The search menu item will now be invisible to guests.   ;)



Dr. Beast

It's already disabled but search is still showing. I'm using latest 2.0.6 version.

Illori

then try to fix the error instead

Admin -> Server Settings -> Disable evaluation of templates
Then post any new error messages without eval in them

Dr. Beast

http://domain.com/index.php?action=search2 [nofollow]
8: Undefined index: title
File: /path/Themes/default/index.template.php
Line: 422

http://domain.com/index.php?action=search2 [nofollow]
8: Undefined index: href
File: /path/Themes/default/index.template.php
Line: 421

Kindred

and what are those lines in your index.template.php?

And what mods do you have installed?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Dr. Beast

Quote from: Kindred on December 13, 2013, 07:50:09 AM
and what are those lines in your index.template.php?

And what mods do you have installed?


foreach ($context['menu_buttons'] as $act => $button)
{
echo '
<li id="button_', $act, '">
line 421 - <a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
line 422 - <span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
</a>';



I've installed SMF Notify Group and Ohara YouTube Embed.

Kindred

so...
1- it seems that your theme is not using he standard 2.0.x design for menus (in 2.0.x the menus are not handled in the display template)
2- it seems that you have some other mod which has added a menu item but does not have all the values defined all the time...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Dr. Beast

Hm, theme is default and it isn't modified by me and only those two plugins are installed.

Illori

then attach your sources/subs.php file to your next post.

Dr. Beast

Quote from: Illori on December 13, 2013, 08:10:31 AM
then attach your sources/subs.php file to your next post.

Here it is.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

your subs.php file looks fine, so the issue must be with one of your mods.

Dr. Beast

Quote from: Kindred on December 13, 2013, 08:16:21 AM
what is your actual url?

Is't on local network, not accessible from outside.

Kays

Those errors usually occur when a button for an action has been removed. Probably the Search button in this case.

To fix those, in Subs.php look for:


$context['menu_buttons'][$current_action]['active_button'] = true;


And replace it with:


if (isset($context['menu_buttons'][$current_action]))
$context['menu_buttons'][$current_action]['active_button'] = true;

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Illori

Quote from: Kays on December 13, 2013, 09:27:27 AM
Those errors usually occur when a button for an action has been removed. Probably the Search button in this case.

i doubt that is the issue, see the subs.php file attached further up. it has no edits that i can see at all.

Kays

Quote
http://domain.com/index.php?action=search2 [nofollow]
8: Undefined index: title
File: /path/Themes/default/index.template.php
Line: 422

In this case the action is search2 which is checked as the same action as search.


elseif ($context['current_action'] == 'search2')
$current_action = 'search';


Since search is disabled for guests, there is no button, hence the error.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Arantor

Kays is right, this is a known issue in 2.0, just like it's a known issue that the quick search box doesn't adhere to permissions and is always shown as a result.

Advertisement: