Help with a simple Hide Button / Show Button Code

Started by JWServers, June 13, 2005, 06:13:12 AM

Previous topic - Next topic

JWServers

Hey guys im working on a neat Mod for my SMF - that is all 100% complete and Stable

but im trying to add a user option to enable hiding a button from Guests - or Disable hiding the button from guests etc...

in other words i want a code that will enable a admin to mark the button as hidden from guests - or vice versa enable admin to mark it as show to guests

here is a sniplet of my code

<file name="$boarddir/Themes/classic/index.template.php" error="skip">
   <operation>
   <search position="before"><![CDATA[
            <a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];
]]></search>
   <add><![CDATA[

//Below this line is the Code that i have now -- which just hides it from guests period -- i have a variable called $chatUser  -- that is all setup i just need the bit of code to make it so when $chatUser is set to TRUE - it Hides the Link from guests - & if $chatUser is set FALSE - it Shows the button to Guests & registered users

Code is here -->                      if (!$context['user']['is_guest'])

      echo '
            <a href="', $scripturl, '?action=chat" target="_blank">', ($settings['use_image_buttons'] ? ' <img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt['chatAlt'] . '" target="_blank" style="margin: 2px 0;" border="0" />' : $txt['chatAlt']), '</a>', $context['menu_separator'];

]]></add>
   </operation>
</file>


I dont know enough of SMF's code or variables to code it myself i tried a simple PHP one

if ($chatUser == 1)

& ive tried if ($chatUser == TRUE)

but neither have worked - and now im in the blue as to how SMF's Code is so i cannot go from here

any help is appreciated

in the mean time imma dig through other SMF Files and see if i can find a code segment that will work

JW


Advertisement: