I found this and it looks interesting. Would defiantly come in handy.
Add Multiple Options Per User
If someone would help me out that would be great
Add Multiple Options Per User
If someone would help me out that would be great
<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="myproductid">
<bitfielddefs>
<group name="misc">
<group name="mybitoptionsfield">
<bitfield name="option1">1</bitfield>
<bitfield name="option2">2</bitfield>
</group>
</group>
</bitfielddefs>
</bitfields>
$db->hide_errors();
$db->query_write("ALTER TABLE `" . TABLE_PREFIX . "user` ADD `mybitoptionsfield` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `options`");
require_once(DIR . '/includes/class_bitfield_builder.php');
$myobj =& vB_Bitfield_Builder::init();
$myobj->save($db);
build_forum_permissions();
$db->show_errors();
PHP Code:
$db->hide_errors();
$db->query_write("ALTER TABLE `" . TABLE_PREFIX . "user` DROP `mybitoptionsfield`");
require_once(DIR . '/includes/class_bitfield_builder.php');
$myobj =& vB_Bitfield_Builder::init();
$myobj->save($db);
build_forum_permissions();
$db->show_errors();
if (isset($vbulletin->bf_misc['mybitoptionsfield']))
{
foreach ($vbulletin->bf_misc['mybitoptionsfield'] AS $optionname => $optionval)
{
$user["$optionname"] = ($user['mybitoptionsfield'] & $optionval ? 1 : 0);
}
}
<fieldset class="fieldset">
<legend><label for="cb_option1">OPTION1_HEADING1</label></legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td>
OPTION1_DESCRIPTION1
</td>
</tr>
<tr>
<td><label for="cb_option1"><input type="checkbox" name="mybitoptionsfield[option1]" value="1" id="cb_option1" $checked[option1] />OPTION1_HEADING1</label><input type="hidden" name="set_options[option1]" value="1" /></td>
</tr>
</table>
</fieldset>
<fieldset class="fieldset">
<legend><label for="cb_option2">OPTION2_HEADING2</label></legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td>
OPTION2_DESCRIPTION2
</td>
</tr>
<tr>
<td><label for="cb_option2"><input type="checkbox" name="mybitoptionsfield[option2]" value="1" id="cb_option2" $checked[option2] />OPTION2_HEADING2</label><input type="hidden" name="set_options[option2]" value="2" /></td>
</tr>
</table>
</fieldset>
if (isset($vbulletin->bf_misc['mybitoptionsfield']))
{
$vbulletin->input->clean_gpc('p', 'mybitoptionsfield', TYPE_ARRAY_BOOL);
foreach ($vbulletin->bf_misc['mybitoptionsfield'] AS $key => $val)
{
if (isset($vbulletin->GPC['mybitoptionsfield']["$key"]) OR isset($vbulletin->GPC['set_options']["$key"]))
{
$userdata->set_bitfield('mybitoptionsfield', $key, $vbulletin->GPC['mybitoptionsfield']["$key"]);
}
}
}
if (isset($vbulletin->bf_misc['mybitoptionsfield']))
{
print_table_break('', $INNERTABLEWIDTH);
$mybitoptionsfield = convert_bits_to_array($user['mybitoptionsfield'], $vbulletin->bf_misc['mybitoptionsfield']);
$user = array_merge($user, $mybitoptionsfield);
print_table_header('MYHEADING');
print_yes_no_row('MYOPTION1', 'mybitoptionsfield[option1]', $user['option1']);
print_yes_no_row('MYOPTION2', 'mybitoptionsfield[option2]', $user['option2']);
}
if (isset($vbulletin->bf_misc['mybitoptionsfield']))
{
$vbulletin->input->clean_gpc('p', 'mybitoptionsfield', TYPE_ARRAY_BOOL);
foreach ($vbulletin->GPC['mybitoptionsfield'] AS $key => $val)
{
if (isset($vbulletin->GPC['mybitoptionsfield']["$key"]))
{
$userdata->set_bitfield('mybitoptionsfield', $key, $val);
}
}
}
if (isset($this->registry->bf_misc['mybitoptionsfield']))
{
$this->bitfields["mybitoptionsfield"] =& $this->registry->bf_misc['mybitoptionsfield'];
}