MyBB Community Forums

Full Version: Admin settings code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Afaik the settings.php don't use the adminfunctions.php.

You can change it to something like this:

function makeyesnocode($title, $name, $value="yes", $output = true)
{
	global $lang;
	$bgcolor = getaltbg();
	if($value == "no") {
		$nocheck = "checked=\"checked\"";
	} else {
		$yescheck = "checked=\"checked\"";
	}
	if ($output) {
		echo "<tr>\n<td class=\"$bgcolor\" valign=\"top\" width=\"40%\">$title</td>\n<td class=\"$bgcolor\" valign=\"top\" width=\"60%\"><label><input type=\"radio\" name=\"$name\" value=\"yes\" $yescheck />&nbsp;$lang->yes</label> &nbsp;&nbsp;<label><input type=\"radio\" name=\"$name\" value=\"no\" $nocheck />&nbsp;$lang->no</label></td>\n</tr>\n";
	} else {
		return "<label><input type=\"radio\" name=\"$name\" value=\"yes\" $yescheck />&nbsp;$lang->yes</label> &nbsp;&nbsp;<label><input type=\"radio\" name=\"$name\" value=\"no\" $nocheck />&nbsp;$lang->no</label>\n";
	}
}

So it looks then in settings.php:

else if($type[0] == "yesno") {
	$settingcode = makeyesnocode("xxx", "upsetting[$setting[sid]]", $setting['value'], false);

I only noticed this because the yes / no text isn't labeled.