Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

I Want To Hide A Button

Aloittaja Jackson Cage, maaliskuu 06, 2005, 11:19:23 AP

« edellinen - seuraava »

Jackson Cage

I recently added a new button to my members only forum. Is there any way I can make that button acccessable ONLY if you're signed on as a member ???

Louis (CSpotkill)

I'm assuming you're editing a theme file directly. Try adding the following around your button:
if ($context['user']['is_logged'])
{
echo 'Button Goes Here';
}


If you're editing template_menu(), see the "// If the user is a guest, show [login] and [register] buttons." for an example.
My SMF Mods:

Jackson Cage

Lainaus käyttäjältä: Jackson Cage - maaliskuu 06, 2005, 11:19:23 AP
I recently added a new button to my members only forum. Is there any way I can make that button acccessable ONLY if you're signed on as a member ???

I couldn't really follow what you were saying. What I did is cut and paste a button code that wasn't showing while you were logged off. Then I added another button. It worked until I added the second button.

This is my  code

// Otherwise, they might want to [logout]...
   else
       
        echo '
            <a href="http://client1.sigmachat.com/sc.pl?id=94058">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
       
        echo '
            <a href="http://www.thejacksoncage.com/pictures/pics.html">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/pics.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
           
        echo '
            <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';



The first button CHAT doesn't show up and niether does the last button LOGOUT but the PICS button in between does showup. What am I doing wrong ??

Louis (CSpotkill)

#3
Insert the following just before // If the user is a guest, show [login] and [register] buttons. (shown):

if ($context['user']['is_logged'])
{
        echo '<a href="http://client1.sigmachat.com/sc.pl?id=94058">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/chat.gif" alt="' $txt[108] . '" style="margin: 2px 0;" border="0" />' $txt[108]), '</a>';
       
        echo '<a href="http://www.thejacksoncage.com/pictures/pics.html">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/pics.gif" alt="' $txt[108] . '" style="margin: 2px 0;" border="0" />' $txt[108]), '</a>';
}
// If the user is a guest, show [login] and [register] buttons.


Now does what I posted make more sense? It basically says, in English, "if user is logged in, show the stuff between the braces".

Also, make sure both chat.gif and pics.gif are in \themes\default\images\english\ (or similar)
My SMF Mods:

Jackson Cage

That worked. Thank you very much for your help.

Advertisement: