Table of Contents

Install new organizational settings

Quite often it can happen that you need new settings for specific modules. These are then usually maintained in the organization settings. In order to add new settings will not become too laboriously, we have developed a mechanism by which this works relatively quickly.

1. Built in the installation script

The variable is also available with a new installation with a default value, a corresponding entry in the adm_install/scripts/preferences.php in the array $orga_preferences must be added. Naming the variable you should make sure that at the beginning of the name the module name is determined where the variable is used and that the name is as descriptive as possible eg. profile_show_map_link. This is more understandable in the code, what the variable is and what it is intended for.

Users who update Admidio also automatically receive the settings from the preferences.php. A SQL entry are must be created in the file upd_x_x.conv.php if you want, however here set other default parameter (eg to maintain a previous operation). An example is available in upd_1_3_conv.php line 56 - 102. If there are no entries in the current script, the loop must also be copied on all organizations!

In the code you can access to the new setting new_variable:

 $gPreferences ["new_variable"] 

2. Built in the organization settings

Do not forget you should of course integrate the setting in the organization module. Here you just have to create a field where the value will be adjusted. It is important that the name of the field is equal to the name of the setting, otherwise the reading and writing back is not working. Is the inserted field of type checkbox, so it also must be entered in the file organization_function.php in the array $checkboxes.

Defaults or examples are given at the end of the description text, after the point of the last sentence in brackets. (Standard: xyzEINHEIT) / (Example: ksjdgfkjhsd)

Alternative for developing and testing

If I want only add a new setting to test something, so I can do this directly in the database via phpMyAdmin or MySQL Query Browser once. Here you just have to take in account the Orga-Id and naming the variables with a useful name(eg 'test_variable') with initial value ('Test').

Even now I can work in the scripts with the following code:

 echo $gPreferences["test_variable"]; Output: test 

Important notes

Further settings are not necessary for the use of new variables. The variable is automatically stored and updated and is available globally under the array mentioned above.

Still remember that the organization variables are stored in the session. If you change these values not on the surface, but directly in the database, it is not updated in the session. In this case, you should close the browser and restart it.