Advertisement:

Author Topic: preventing use of a certain theme  (Read 21841 times)

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
preventing use of a certain theme
« on: August 02, 2005, 01:45:05 PM »
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.



Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,098
  • Gender: Male
    • Kindred-999 on GitHub
Re: preventing use of a certain theme
« Reply #1 on: August 02, 2005, 01:53:19 PM »
ummm.... delete the theme?
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #2 on: August 02, 2005, 02:10:43 PM »
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.



Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,098
  • Gender: Male
    • Kindred-999 on GitHub
Re: preventing use of a certain theme
« Reply #3 on: August 02, 2005, 02:28:37 PM »
then either turn off the option for users to change their theme....   or write a mod...
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #4 on: August 02, 2005, 02:37:12 PM »
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.



Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,098
  • Gender: Male
    • Kindred-999 on GitHub
Re: preventing use of a certain theme
« Reply #5 on: August 02, 2005, 02:43:32 PM »
Tippmaster...   what you are looking to do is add a function that does not currently exist.   Hence a mod.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #6 on: August 02, 2005, 02:46:43 PM »
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

  • Guest
Re: preventing use of a certain theme
« Reply #7 on: August 02, 2005, 03:43:14 PM »
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:
Code: [Select]
// 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.
Code: [Select]
// 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 />';
        }
}

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #8 on: August 02, 2005, 03:44:25 PM »
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?
« Last Edit: August 02, 2005, 03:48:01 PM by Tippmaster »
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

  • Guest
Re: preventing use of a certain theme
« Reply #9 on: August 02, 2005, 03:53:32 PM »
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.
« Last Edit: August 02, 2005, 03:55:49 PM by Bloc »

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #10 on: August 02, 2005, 04:00:21 PM »
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

  • Guest
Re: preventing use of a certain theme
« Reply #11 on: August 02, 2005, 05:15:43 PM »
:) Good to hear it worked fine.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: preventing use of a certain theme
« Reply #12 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]

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #13 on: August 02, 2005, 10:56:18 PM »
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.. :(
« Last Edit: August 02, 2005, 10:57:58 PM by Tippmaster »
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

  • Guest
Re: preventing use of a certain theme
« Reply #14 on: August 03, 2005, 06:51:04 AM »
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

  • Guest
Re: preventing use of a certain theme
« Reply #15 on: August 03, 2005, 06:52:21 AM »
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.

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: preventing use of a certain theme
« Reply #16 on: January 14, 2006, 01:02:45 PM »
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.

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

  • Guest
Re: preventing use of a certain theme
« Reply #17 on: November 12, 2006, 02:53:18 PM »
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. ;)