News:

Wondering if this will always be free?  See why free is better.

Main Menu

preventing use of a certain theme

Started by 1MileCrash, August 02, 2005, 01:45:05 PM

Previous topic - Next topic

1MileCrash

what would i need to do to prevent anyone from using a certain theme? I searched and got nadda.
The only thing php can't do is tell you how much milk is left in the fridge.



Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

1MileCrash

no, i need to have it. I dont want to explain right now, but i must have the theme.
The only thing php can't do is tell you how much milk is left in the fridge.



Kindred

then either turn off the option for users to change their theme....   or write a mod...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

1MileCrash

i have already thought over the obvious answers....and i dont see the point of writing a mod, considering i dont want to make any new feature, or functionallity, and not many people will find use to this request. I just want to disable the option of the theme to show up, but it still needs to be installed.
The only thing php can't do is tell you how much milk is left in the fridge.



Kindred

Tippmaster...   what you are looking to do is add a function that does not currently exist.   Hence a mod.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

1MileCrash

i was thinking something more along the lines of a "Tips and Tricks" thing. Like a simple line of code that would prevent the id of the theme from being displayed under "Looks and layout preferences".

I could go without doing this, i would just have to install two forums.
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

There is one possibility...

If you open up Themes.template.php in default theme folder(and also any other theme that has that template) and find this code:
// This template allows for the selection of different themes ;).
function template_pick()
{
        global $context, $settings, $options, $scripturl, $txt;

        // Just go through each theme and show its information - thumbnail, etc.
        foreach ($context['available_themes'] as $theme)
                echo '
        <table align="center" width="85%" cellpadding="3" cellspacing="0" border="0" class="tborder">
                <tr class="', $theme['selected'] ? 'windowbg' : 'windowbg2', '">
                        <td rowspan="2" width="126" height="120"><img src="', $theme['thumbnail_href'], '" alt="" /></td>
                        <td valign="top" style="padding-top: 5px;">
                                <div style="font-size: larger; padding-bottom: 6px;"><b><a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';sesc=', $context['session_id'], '">', $theme['name'], '</a></b></div>
                                ', $theme['description'], '
                        </td>
                </tr>
                <tr class="', $theme['selected'] ? 'windowbg' : 'windowbg2', '">
                        <td valign="bottom" align="right" style="padding: 6px; padding-top: 0;">
                                <div style="float: left;" class="smalltext"><i>', $theme['num_users'], ' ', ($theme['num_users'] == 1 ? $txt['theme_user'] : $txt['theme_users']), '</i></div>
                                <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';sesc=', $context['session_id'], '">', $txt['theme_set'], '</a> |
                                <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';theme=', $theme['id'], ';sesc=', $context['session_id'], '">', $txt['theme_preview'], '</a>
                        </td>
                </tr>
        </table>
        <br />';
}


And simply insert an IF statement there, to check the id..you could do what you need. It would be just the option of choosing of course..doing index.php?theme=xx would still work as before.
// This template allows for the selection of different themes ;).
function template_pick()
{
        global $context, $settings, $options, $scripturl, $txt;

        $hidden_themeID= 5;

        // Just go through each theme and show its information - thumbnail, etc.
        foreach ($context['available_themes'] as $theme){
          if($theme['id'] != $hidden_themeID)
                echo '
        <table align="center" width="85%" cellpadding="3" cellspacing="0" border="0" class="tborder">
                <tr class="', $theme['selected'] ? 'windowbg' : 'windowbg2', '">
                        <td rowspan="2" width="126" height="120"><img src="', $theme['thumbnail_href'], '" alt="" /></td>
                        <td valign="top" style="padding-top: 5px;">
                                <div style="font-size: larger; padding-bottom: 6px;"><b><a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';sesc=', $context['session_id'], '">', $theme['name'], '</a></b></div>
                                ', $theme['description'], '
                        </td>
                </tr>
                <tr class="', $theme['selected'] ? 'windowbg' : 'windowbg2', '">
                        <td valign="bottom" align="right" style="padding: 6px; padding-top: 0;">
                                <div style="float: left;" class="smalltext"><i>', $theme['num_users'], ' ', ($theme['num_users'] == 1 ? $txt['theme_user'] : $txt['theme_users']), '</i></div>
                                <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';sesc=', $context['session_id'], '">', $txt['theme_set'], '</a> |
                                <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';theme=', $theme['id'], ';sesc=', $context['session_id'], '">', $txt['theme_preview'], '</a>
                        </td>
                </tr>
        </table>
        <br />';
        }
}


1MileCrash

#8
Thanks bloc! That's exactly the kind of thing i was hoping to get!  :D


EDIT: do any current themes have their own Themes.template.php? Or no?
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

#9
Oh, yes. ;) My themes. :P

Well, at least Themis, Helios, Simplicity etc. But none of them have changed that function, so you could copy the entire bit over in one sweep on each.

EDIT:

Of course this could be done at source file level too, but when upgrading the forum its lost. In themes it won't be, except for default theme.

1MileCrash

im here to conclude that this worked flawlessly. Whatever theme i specify, it remains hidden.

Im just going to edit all of your theme's Themes.template.php as well. You themes are worth it.  :D
The only thing php can't do is tell you how much milk is left in the fridge.



bloc


[Unknown]

Actually, the simplest way is to edit the "knownThemes" row in the settings table, and remove the theme's id from the list.

Only administrators will be able to use the theme (and only with direct links containing ?theme=###) after that, until the id is put back in the list.

-[Unknown]

1MileCrash

#13
ill have to try that [Unknown]

Bloc, there actually is a problem with the code you posted. I cannot switch themes. All but the hidden ones display, but the links do nothing, it just refreshes the page...and keeps me on the same skin.. :(
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

There shouldn't be any different with that code...have you tried to use a theme with the original code intact? Just to check if it really is the changed code?

bloc

Quote from: [Unknown] on August 02, 2005, 09:11:48 PM
Actually, the simplest way is to edit the "knownThemes" row in the settings table, and remove the theme's id from the list.

Only administrators will be able to use the theme (and only with direct links containing ?theme=###) after that, until the id is put back in the list.

-[Unknown]

A much simpler solution, yes. ;D And it will affect all themes right away too.

1MileCrash

sorry for the bumpage...

regarding [unknown]'s suggestion, if i delete it from the knownThemes row, will i still be able to use the theme in SSI? like $ssi_theme = 4; or w/e it is.

Quote from: [Unknown] on August 02, 2005, 09:11:48 PM
Actually, the simplest way is to edit the "knownThemes" row in the settings table, and remove the theme's id from the list.

Only administrators will be able to use the theme (and only with direct links containing ?theme=###) after that, until the id is put back in the list.

-[Unknown]
The only thing php can't do is tell you how much milk is left in the fridge.



kat

When I'm fiddling with a theme, I just post a message telling everyone that I'm working on it, reset everyone to the forum default theme and uncheck "Allow users to change their themes" in admin, until I'm done. ;)

Advertisement: