Logged in button code only?

Started by Chipfryer, January 13, 2007, 04:04:16 PM

Previous topic - Next topic

Chipfryer

SMF Version: SMF 1.1.1
Hi
I've been adding buttons to my index_template.php with a lot of success, thank you.

Question:
How would I add a button that only logged in people would see please?
Many thanks.
:)

codenaught

You can use:

if ($context['user']['is_logged'])
{
     echo ' <Button Code>';
}


You can always look at how SMF shows the logout button when you are logged in:

// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
Dev Consultant
Former SMF Doc Coordinator

Advertisement: