MyBB Community Forums

Full Version: Quick Theme Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
TikiTiki,

Would it be easy to change the way the drop down menu works, so that when a user selects the theme they want it changes automatically when selected instead of having to click the button ?

Thanks
lazy members ? =P
not really, i know how to do this in a basic html page, but the html for this plugin is inside the plugin php file, so am unsure how to format the code
It uses the build_theme_select() function so with just a change in the plugin file it probably won't do much but i could be wrong Wink And wouldn't it require jscript for the "onChange" event on the dropdown ?
LeX- Wrote:It uses the build_theme_select() function so with just a change in the plugin file it probably won't do much but i could be wrong Wink And wouldn't it require jscript for the "onChange" event on the dropdown ?

I believe something like this would work but im not sure where to put it in the file, of course the name is whatever the plugin has

<select name="menu2" 
onChange="top.location.href = this.form.menu2.options[this.form.menu2.selectedIndex].value;
return false;">
The build_theme_select () is located in the inc/functions.php file
Just add:
onchange="this.form.submit();"
Smile
I did this, once. I don't remember the exact code, but it make the select, found a part in it, and changed to to the code in CraKteR's post, then outputed it.
I'm guessing i have to change the file LeX mentioned, is it this bit

function build_theme_select($name, $selected="", $tid=0, $depth="", $usergroup_override=0)
{
	global $db, $themeselect, $tcache, $lang, $mybb, $limit;
	
	if($tid == 0)
	{
		$themeselect = "<select name=\"$name\">";
		$themeselect .= "<option value=\"0\">".$lang->use_default."</option>\n";
		$themeselect .= "<option value=\"0\">-----------</option>\n";
		$tid = 1;
	}
	
	if(!is_array($tcache))
	{

If so where do i put Crakters code, i tried just after the name=\"$name\" but got an error
This works ::

$themeselect = "<select name=\"$name\" onchange=\"this.form.submit();\">";
Pages: 1 2