plugin setting dynamic field
#1
Is there a way to generate plugin setting fields dynamically?

I am creating a plugin, which requires multiple values, that cannot be defined at the time of installation

Something like,

$mybb->settings['myplugin_dynamic1'];
$mybb->settings['myplugin_dynamic2'];
and so on...
Visit our DevOps  Forums | MyBB plugins: Addthis
Reply
#2
What exactly are you trying to achieve? You can set new keys on the settings array, but they won't be saved to the database unless you actually insert them into the database.
Reply
#3
i thin this may serve:

http://docs.mybb.com/1.8/development/plu...n-settings

Use the select box or radio or similar and add your values then set on your plugin args values and done, you may select that option and with a value you may change between one or two values, see yah !!
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply
#4
Say, I have 3 setting fields when my plugin installed, and option to add more fields
Active:Yes
Field1: value
Field2: value
-- Option to add additional field here --
Once I click on the link/button to add more fields, it should be created dynamically and should store its value to database.


Expected Result:
Active:Yes
Field1: value
Field2: value
Field3: value (dynamically created)
Field4: value (dynamically created)
-- Option to add additional field here --
Visit our DevOps  Forums | MyBB plugins: Addthis
Reply
#5
create new sub page in acp like word filers
My Plugins

PM only paid support
Reply
#6
Look at MariaDB as a database instead of MySQL. You can get native support for something kind of like what you want. If you tweaked the database driver, you could dynamically add or remove fields on the fly.

https://mariadb.com/kb/en/mariadb/dynamic-columns/
PGP Key (Fingerprint: 23B6 F4C0 FE2D 45AA 61A0 1E86 DB87 09DC DD87 6E40)
Reply
#7
(2015-04-15, 09:09 PM)Supryk Wrote: create new sub page in acp like word filers
You understood my requirement, however I could not figure out a way, how to do this?
Visit our DevOps  Forums | MyBB plugins: Addthis
Reply
#8
Create a new .php file in admin/modules/config (or any other subfolder). It should be similar to other modules and include code like IN_MYBB check, $page->add_breadcrumb_item(), $page->output_footer(), your inputs, actions, etc. Then hook to submenu (located in admin/modules/[subfolder]/module_meta.php - for example admin_config_menu) and show a link to it. Similarly, implement admin permissions for it.
Reply
#9
Really helpful, it worked! Thank you Smile
Visit our DevOps  Forums | MyBB plugins: Addthis
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)