MyBB Community Forums

Full Version: Forum Dropdown in Plugin Settings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
You should look Tomm's Post Reputation code. He builds the Forum select on-the-fly instead of loading it into the database. He hooks somewhere in the ACP settings module but since I'm not at home I can't tell you where.

In the meantime till I get home, I can give you the flow of the hack.

In the first part you hijack the settings group you want using the row id in which you'll add the select, and replace a textual input using a preg_replace to get its values, putting them into the select.

In the second part you inject your code straight into the updating process: you use the gid of your settings group (you'll need a query for this unfortunately) to detect when your settings are about to be updated and convert the array passed by the select box into a textual comma-separated string of values (the forums ids). This part can be omitted if you use a single-value select box: in this case, the passed value is just an integer and not an array (thus it can be inserted into the database directly).
Pages: 1 2