2012-08-15, 11:49 AM
Sorry for the late reply
You need to insert the setting in a query each time, however you only need to rebuild the settings once, so you could use something like this:
As for question 2:
If one of my settings contained a text area, like below:
You can echo the contents of that setting like this:
Notice myfirstplugin_input is the name of the setting.
You need to insert the setting in a query each time, however you only need to rebuild the settings once, so you could use something like this:
$myfirstplugin_setting_1 = array(
'sid' => 'NULL',
'name' => 'myfirstplugin_enable',
'title' => 'Do you want to enable My First Plugin?',
'description' => 'If you set this option to yes, this plugin be active on your board.',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 1,
'gid' => intval($gid),
);
$myfirstplugin_setting_2 = array(
'sid' => 'NULL',
'name' => 'myfirstplugin_something',
'title' => 'My First Plugin',
'description' => 'My First Plugin - description',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 2,
'gid' => intval($gid),
);
$myfirstplugin_setting_3 = array(
'sid' => 'NULL',
'name' => 'myfirstplugin_somethingelse',
'title' => 'My First Plugin',
'description' => 'My First Plugin - description',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 3,
'gid' => intval($gid),
);
$myfirstplugin_setting_4 = array(
'sid' => 'NULL',
'name' => 'myfirstplugin_anything',
'title' => 'My First Plugin',
'description' => 'My First Plugin - description',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 4,
'gid' => intval($gid),
);
$db->insert_query('settings', $myfirstplugin_setting_1);
$db->insert_query('settings', $myfirstplugin_setting_2);
$db->insert_query('settings', $myfirstplugin_setting_3);
$db->insert_query('settings', $myfirstplugin_setting_4);
rebuild_settings();
As for question 2:
If one of my settings contained a text area, like below:
$myfirstplugin_setting_2 = array(
'sid' => 'NULL',
'name' => 'myfirstplugin_input',
'title' => 'My First Plugin',
'description' => 'My First Plugin - description',
'optionscode' => 'textarea',
'value' => '',
'disporder' => 2,
'gid' => intval($gid),
);
You can echo the contents of that setting like this:
echo $mybb->settings['myfirstplugin_input'];
Notice myfirstplugin_input is the name of the setting.