[4862] 2.0.1 When search not allowed, search box in head forum must be hidden

Started by davidhs, November 11, 2011, 07:53:41 AM

Previous topic - Next topic

davidhs

SMF 2.0.1. When search are not allowed, search box in head of forum must be hidden

I do not know if this is a bug or a enhancement.

When a user can not search in forum, main menu have not search option
QuoteSMF 2.0.1
File: Sources/Subs.php
Function: setupMenuContext()
Line: 3908
Code:
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),
but head of forum show a search box.

This search box must be hidden
QuoteSMF 2.0.1
File: Themes/default/index.template.php
Function: template_body_above()
Line: 248
Code:
echo '
</div>
<div class="news normaltext">
<form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />&nbsp;
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '</form>';

// Show a random news item? (or you could pick one from news_lines...)

must be replaced by
echo '
</div>
<div class="news normaltext">';
if ($context['allow_search'])
{
echo '
<form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />&nbsp;
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '</form>';
}

// Show a random news item? (or you could pick one from news_lines...)

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Sir Osis of Liver


Agreed.  I ran into that problem on a busy forum, and coded out the header search widget for guests.  They get a message that they're not allowed to use it, and it throws yet another error into the log.

Even if the whole world has forgotten,
The song remembers when.

                              - H. Prestwood

Advertisement: