MyBB Community Forums

Full Version: Quick theme change
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Like you have for the theme demo, but above where the open buddy list links is instead. This would be nice for my members.
The theme demo script is one of the few that I won't be releasing.

Sorry about that.
i'll write this script up tonite.
I was working on it...

I will release it anyway

if anyone already working on it

just reply here Smile



I guess you'd need musicalmidget's permission for releasing this mod.
Why? You can release a different version of the mod. It's not like you are stealing his source code and making it your own.
I just did this

any of you could add it Smile







<?

require "./global.php";




echo "Style Selector";

echo "


<!-- start of theme selector -->
<form method=post action=\\"\\">

<input type=hidden name=action value=setstyle />&nbsp;
<select name=tid>";


$query = $db->query("SELECT * FROM ".TABLE_PREFIX."themes WHERE name!='((master))' AND name!='((master-backup))' ORDER BY name ASC");
while($style = $db->fetch_array($query)) {
$style['sid'] = $style['tid'];
if($style['tid'] == $mybbuser['style']) {
$selected = "selected";
}
echo "<option value=$style[sid] $selected>$style[name]</option>";
$selected = "";
}

echo " 
</select>
<input type=submit value=Go />
</form>
<!-- theme selector end -->




<p>


";



if ($action == "setstyle") {
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$tid' WHERE uid='$mybb[uid]'");	
}



?>



I just re-did my code little.
If you have better method. feel free to reply Wink


here is my instructions for my mod.

open index.php


add this under

// Load global language phrases
$lang->load("index");


////// skins selector //////// 
echo "<br>
<!-- start of theme selector -->
<table border=0 width=$theme[maintablewidth]><tr><td align=right>
<form method=post action="">
Style Selector: <input type=hidden name=action value=setstyle />&nbsp;
<select name=tid>";

$query = $db->query("SELECT * FROM ".TABLE_PREFIX."themes WHERE name!='((master))' AND name!='((master-backup))' ORDER BY name ASC");
while($style = $db->fetch_array($query)) {
$style['sid'] = $style['tid'];
if($style['tid'] == $mybbuser['style']) {
$selected = "selected";
}
echo "<option value=$style[sid] $selected>$style[name]</option>";
$selected = "";
}

echo " 
</select>
<input type=submit value=Go />
</form>
</tr></td></table>
<!-- theme selector end -->";


if ($action == "setstyle") {
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$tid' WHERE uid='$mybb[uid]'");	
echo "<meta http-equiv="refresh" content="0;URL=$settings[bburl]">";
}
/////////////////////////////////////
////// skins selector ////////
if($mybbuser['usergroup'] != "0") {
echo "<br>
<!-- start of theme selector -->
<table border=0 width=$theme[maintablewidth]><tr><td align=right>
<form method=post action="">
Style Selector: <input type=hidden name=action value=setstyle />
<select name=tid>";

$query = $db->query("SELECT * FROM ".TABLE_PREFIX."themes WHERE name!='((master))' AND name!='((master-backup))' ORDER BY name ASC");
while($style = $db->fetch_array($query)) {
$style['sid'] = $style['tid'];
if($style['tid'] == $mybbuser['style']) {
$selected = "selected";
}
echo "<option value=$style[sid] $selected>$style[name]</option>";
$selected = "";
}

echo "
</select>
<input type=submit value=Go />
</form>
</tr></td></table>
<!-- theme selector end -->";


if ($action == "setstyle") {
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$tid' WHERE uid='$mybb[uid]'");    
echo "<meta http-equiv="refresh" content="0;URL=$settings[bburl]">";
}
}
/////////////////////////////////////
Added a check to see if they are registered cause non-members cant change the style.

And whats with <input type=hidden name=action value=setstyle />

Why not just turn action="" into action="?action=setstyle" and remove <input type=hidden name=action value=setstyle /> altogether?
k776

do you think you could do templates instead of echo

I tried to but my forums seem wotn read my custom templates.

Pages: 1 2