SMF Support > SMF 2.0.x Support

Force collapsed header

(1/1)

polkablues:
Is there a way to set preferences so that the header is automatically shrunk when someone logs in?  We recently installed a shoutbox that shows up in the lower portion of the expanded header, which is great, but it would be better if it was hidden until people want to see it.

I have a feeling it's related to this, from index.template.php:

--- Code: ---// Define the upper_section toggle in JavaScript.
   echo '
      <script type="text/javascript"><!-- // --><![CDATA[
         var oMainHeaderToggle = new smc_Toggle({
            bToggleEnabled: true,
            bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
            aSwappableContainers: [
               \'upper_section\'
            ],
--- End code ---

but I don't know what to change to have the effect that I'm looking for.

We're using SMF 2.0.2, default Curve theme, by the way.

Oldiesmann:
I believe this should do it. I haven't tested it though so let me know if it doesn't work.

Themes/default/scripts/script.js

Find

--- Code: --- if (cookieValue != null)
this.opt.bCurrentlyCollapsed = cookieValue == '1';
--- End code ---

Add after that

--- Code: --- else
this.opt.bCurrentlyCollapsed = true;
--- End code ---

polkablues:
That seems to do the trick.  Thank you!

nathanmc:
Hi Oldiesmann,

Your modification of the code does remember the users choice of collapsing the boards the next time they log in. However, it doesn't work unless the user first chooses to collapse the boards.

And secondly, if user isn't logged in (guest) then it is not collapsed.

If you could suggest some revised code that'd be awesome.

Thank you.

Navigation

[0] Message Index

Go to full version