News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Hide Menu and Linktree from Login Page?

Started by Plutuss, January 25, 2012, 07:48:38 AM

Previous topic - Next topic

Plutuss


Hello,

What can I do to hide the menu and linktree from the Login page? Our forum is closed to guests, and so we're trying to de-clutter the login page.

Thanks!

Using SMF 2.02

Plutuss


hcfwesker

#2
Please try and not bump a post within a 24 hour period.  Support will provide help when they are here, and if they can help.  Bumping will not speed up the process.  just be patient ;)


You're gonna need to wrap both the menu and linktree in index.template.php with

if ($context['user']['is_logged'])
{
(((  menu or linktree ))
]

Just tested as a user and guest and they worked.

Themes/default*/index.template.php  ( *  or custom themes)


to hide the linktree from guests

Find
// Show the navigation tree.
theme_linktree();


Replace with
// Show the navigation tree.
if ($context['user']['is_logged'])
       {
theme_linktree();
       }



to hide the menu from guests

Find
// Show the menu here, according to the menu sub template.
template_menu();


Replace with
// Show the menu here, according to the menu sub template.
if ($context['user']['is_logged'])
       {
template_menu();
       }


Plutuss

That worked perfectly! Thank you a million.   ;D

Do you know how I can similarly hide the search box? Thanks.  ;)

hcfwesker

#4
In the same file,

Find
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...)



Replace with
if ($context['user']['is_logged'])
       {
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...)

Plutuss


Advertisement: