PDA

View Full Version : vb_datamanager_forum bitfield options


scoutz
08-10-2008, 08:10 PM
I'm trying to set the bitfield options for a script im writing that creates new forums from non-vb pages.


$userdata =& datamanager_init('Forum', $vbulletin, ERRTYPE_SILENT);

$userdata->set('title', $serie['name']);
$userdata->set('title_clean', $serie['name']);
$userdata->set('description', 'Discuss the '.$serie['name']);
$userdata->set('description_clean', 'Discuss the '.$serie['name'];
$userdata->set('parentid', $forumnumber);

//this does not work
$vars = array('active' => 1);
$userdata->set('options', $vars);

$userdata->save();
unset($userdata);


I'm trying to set the options data which I want to be set at 97991 (Act as Forum=1, Forum is Active =1, Forum is Open =1,Index New Posts=1 etc.).

I've tried several values for the options field, nothing worked.

As described in the class_dm_forum.php datamanager class for forum.

var $validfields = array(
'options' => array(TYPE_ARRAY_BOOL, REQ_AUTO),

Anyone knows how to get the options bitfield working here?

Kind regards,

vincent

Opserty
08-10-2008, 09:15 PM
Have you tried the set_bitfield() datamanager function instead?

Else look at forum.php in the AdminCP and see how vBulletin saves the forum options there.

scoutz
08-10-2008, 09:41 PM
thanks for the reply!

I was a bit confused since the vbulletin docs said I should use an array with booleans.

Yeah i got it to work by looking at the /admin/forum.php html output the following did the trick.

$userdata->set_bitfield('options','moderatenewpost', false);
$userdata->set_bitfield('options','moderatenewthread', false);
$userdata->set_bitfield('options','moderateattach', false);
$userdata->set_bitfield('options','styleoverride', false);
$userdata->set_bitfield('options','canhavepassword', true);
$userdata->set_bitfield('options','cancontainthreads', true);
$userdata->set_bitfield('options','active', true);
$userdata->set_bitfield('options','allowposting', true);
$userdata->set_bitfield('options','indexposts', true);
$userdata->set_bitfield('options','allowhtml', false);
$userdata->set_bitfield('options','allowbbcode', true);
$userdata->set_bitfield('options','allowimages', true);
$userdata->set_bitfield('options','allowsmilies', true);
$userdata->set_bitfield('options','allowicons', true);
$userdata->set_bitfield('options','allowratings', true);
$userdata->set_bitfield('options','countposts', true);
$userdata->set_bitfield('options','showonforumjump', false);