*** Untested ***
PHP Code:
if (!functions_exists('array_intersect_key') {
function array_intersect_key() {
$numArgs = func_num_args();
if (2 <= $numArgs) {
$arrays =& func_get_args();
for ($idx = 0; $idx < $numArgs; $idx++) {
if (! is_array($arrays[$idx])) {
trigger_error('Parameter ' . ($idx+1) . ' is not an array', E_USER_ERROR);
return false;
}
}
foreach ($arrays[0] as $key => $val) {
for ($idx = 1; $idx < $numArgs; $idx++) {
if (! array_key_exists($key, $arrays[$idx])) {
unset($arrays[0][$key]);
}
}
}
return $arrays[0];
}
trigger_error('Not enough parameters; two arrays expected', E_USER_ERROR);
return false;
}
}
$forum = fetch_foruminfo($forumid);
$forum['allowbbcode'] = false;
$forumoptions = convert_array_to_bits(array_intersect_key($forum, $_FORUMOPTIONS), $_FORUMOPTIONS);
$DB_site->query("UPDATE " . TABLE_PREFIX . "forum SET options=$forumoptions WHERE forumid=$forumid");
But I think it is by far easier to just execute a query which directly changes what you want to change:
Quote:
now im making a script that will make same options to all of forums
that their teamid !=0 so if ill do allow html
its will edit all forums that their teamid !=0
|
[sql]UPDATE forum SET options=options+256 WHERE teamid != 0 AND NOT (options&256)[/sql]
Don't forget to call build_forum_permissions() afterwards.