News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Simple Theme Changer

Started by Fustrate, August 19, 2008, 11:29:32 PM

Previous topic - Next topic

Fustrate

there is already a mod that does this for 1.1.x... can't remember the exact name though
Steven Hoffman
Former Team Member, 2009-2012

Goodman854

THERE IS? WHATS IT CALLED? Cause I don't see it lol.

Fustrate

Steven Hoffman
Former Team Member, 2009-2012

K3TK3TK3T

will you update this please?

thanks

Fustrate

Ya, it's on my list. Long list ;)
Steven Hoffman
Former Team Member, 2009-2012


Fustrate

Thanks :) Is that also usable for the other spanish_* language files?
Steven Hoffman
Former Team Member, 2009-2012


K3TK3TK3T


Fustrate

Real life takes precedence  :-X

I'm probably going to update all of my mods after RC1 comes out, for my own sanity.
Steven Hoffman
Former Team Member, 2009-2012


Fustrate

Steven Hoffman
Former Team Member, 2009-2012


KahneFan

#eric_on_twit| (video) Creating Themes for SMF | Reset Your Forum
NOTE: No PM's for support please.

Xepernas

Extremely welcome mod.

I have a question about :

Quote from: Fustrate on September 09, 2008, 05:53:30 PM
If you only want certain themes, find this in index.template.php:
foreach ($context['themes'] as $theme)

and add this right after it:
if(in_array($my_themes, $theme['id']))

and right before the foreach(), on the line before it add:
$my_themes = array(1,2, 3, 5, 8);

Is there some code I could type there to make the mod automatically check if a theme is enabled ?

See, I haven't tagged all themes in the "Themes that the user is able to select" page of SMF's Themes and Layout Settings, yet all of them appear in the mod's dropdown menu. Is manually adding/removing themes id the only way to keep the droplist coherent with the enabled themes ?

Fustrate

I'll do that tonight or tomorrow, thanks for pointing that out.
Steven Hoffman
Former Team Member, 2009-2012

Xepernas

Say, news on that ?

I'll have to manually add the code to many themes (aka: destroy our forum), but I've been waiting for the manual code to be updated.

Please warn me if it won't be, I'll just use it as it is now.

Fustrate

in index.php, find:
// Simple Theme Changer
$request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}themes
WHERE variable = {string:name}
AND id_member = 0',
array('name' => 'name')
);

$context['themes'] = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
$context['themes'][$row['id_theme']] = $row['value'];

$smcFunc['db_free_result']($request);
// End Simple Theme Changer


and replace it with

// Make our known themes a little easier to work with.
$enabled_themes = !empty($modSettings['knownThemes']) ? explode(',',$modSettings['knownThemes']) : array();

// Simple Theme Changer
$request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}themes
WHERE variable = {string:name}
AND id_member = 0',
array('name' => 'name')
);

$context['themes'] = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
if(in_array($row['id_theme'], $enabled_themes))
$context['themes'][$row['id_theme']] = $row['value'];

unset($enabled_themes);

$smcFunc['db_free_result']($request);
// End Simple Theme Changer


and see if that works.
Steven Hoffman
Former Team Member, 2009-2012

Quexinos

Sorry but does this work on 2.0 4 beta?....

I only currently have one skin but...

Fustrate

Steven Hoffman
Former Team Member, 2009-2012

Advertisement: