News:

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

Main Menu

Upshrink Default

Started by gusy, November 02, 2006, 03:11:43 PM

Previous topic - Next topic

gusy

I'm looking for information on how to set the default upshrink for both the Info Center and "hello" box. I've read through the following threads:

http://www.simplemachines.org/community/index.php?topic=90776.0
http://www.simplemachines.org/community/index.php?topic=37034.0
http://www.simplemachines.org/community/index.php?topic=69199.0
http://www.simplemachines.org/community/index.php?topic=37455.0
http://www.simplemachines.org/community/index.php?topic=43559.0

and attempted the solutions but none of them did what I was hoping. I've also read through several other threads. Unfortunately searching for "upshrink default" brings up every single thread where a user quotes the BoardIndex.template.php file. I was also told that there should be a topic in the Tips & Tricks forum but I've searched through the entire index and was unable to find this trick.

What I'd like to accomplish is to have these sections upshrinked by default when a guest signs in. If the guest expands these boxes, they should stay open as long as the Guest has their browser window open. If s guest registers and signs in with their new account, these boxes should be upshrunk by default. If the (now registered) user expands these boxes, the setting should be stored so that they remain expanded.

Most of the solutions above involve resetting the boxes to unshrunk every time a guest/user browses to another part of the forum. A few worked moderately better but required the user to click the expand button more than once in order to expand the boxes. Am I missing something obvious? I've searched and experimented for several hours and can't seem to make this seemingly simple change work the way I want. Thank you in advance for any help.

Oldiesmann

Themes/default/index.template.php

Find
// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "', $context['session_id'], '");';


Replace
// Guests don't have theme options!!
if ($context['user']['is_guest'])
{
if(!isset($_COOKIE['upshrink']))
echo '
document.cookie = "upshrink=1";';
else
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);';
}
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "', $context['session_id'], '");';


That should do what you want.
Michael Eshom
Christian Metal Fans

Advertisement: