Tips and tricks
Helpful information in case of problems
If Admidio does not work the way you want it and you're looking for help in the forum etc, please always provide some additional information so we Admidio developers can find the bugs faster and easier.
This information includes (Examples):
- PHP version (v8.2.5)
- Database type + version (MySQL v10.1.2)
- Admidio version (v4.2.12)
- Used Plugins + versions (statistics v3.1.2, written communication)
- Own adjustments were made (different design, own code changes)
- Exception Messages → View Set debug mode (Pay attention to sensitive information!)
- Logdatei Auszüge → View Set debug mode (Pay attention to sensitive information!)
- Detailed instructions on how to make the mistake → Non-reproducible errors are very hard to find
- Screenshots if useful
- If error after update → Check if everything has been updated (Plugins, Libs, Theme, …)
Set debug mode
Even Admidio is not free from problems or bugs. Should you ever have a problem, you can turn on the debug mode for a better analysis. In this mode, every command sent to the database is recorded. In addition, many more informations are logged at every page view. All this will then be saved in a log file.
Please use this mode only if we ask you in the forum or if you can handle the information from the log file. The debug mode should only be used for a limited time in the production system.
You can turn on the debug mode in the config.php by adding the following line if it does not already exist:
$gDebug = 1;
Now, exceptions and other fatal errors are shown directly to the web page, as well as extended information written to the log files. For each day a separate file is created. You can open and analyze these with any text editor.
adm_my_files/logs/admidio-2017-08-23.log
Include PHP code in template files
Admidio uses the template engine Smarty since version 4.0. In the theme folder adm_themes/simple/templates
you can find the template files, which can be customized by you to adapt the layout of Admidio to your wishes.
PHP code cannot be included there for security reasons. If you still want to use your own PHP code in a template file, you can do this via a plugin. Create a new folder in the folder adm_plugins
with a name of your choice, e.g. scripts. In this folder you create a new file for every PHP snippet you want to include e.g. date.php. In this file you can now store HTML and PHP:
<b>The current date is <?php echo date('d.m.Y', time()); ?></b>
In the next step, you can use the following code to place the output of this file anywhere in any template file:
{load_admidio_plugin plugin="scripts" file="date.php"}
This code can simply be placed directly in the HTML of the template file. With plugin=“xyz”
the name of your subfolder of adm_plugins is specified and with file=“xyz”
the filename.
Problems in Photo Upload
Some servers have problems uploading photos. This can have various causes, which are listed here:
- Folder adm_photos does not have the rights 777.
- Folder adm_photos/upload does not have the rights 777.
- The selected files exceed the editable image size from the server so that the dimensons can no longer be detected and an appropriate error message is issued. (The maximum editable image size can be found in the organization Settings under Information System)
- Some servers prohibit the upload file on Flash. This inhibit can partly be evaded. Define a .htaccess file with the following content in the root where Admidio is installed with the following content:
<IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
- (Applies only to profile photo) Some databases do not allow the storage of images in the database itself. In this case, you could Admidio switch the location of profile images in organizational settings > Profile> location of profile images so the profile pictures are stored in the folder adm_my_files.
Error after editing files
Editing and saving files, it could result the following error when viewing the page:
 Warning: Cannot modify header information - headers already sent by (output started at serverpfad/config.php:1) in /serverpfad/index.php on line 6
If this message (individual information in the message may be different)is shown, the file is saved incorrectly as UTF8 file. Admidio expect all the files in the UTF-8 encoding without BOM. The default setting for most editors is UTF-8 with BOM. However, since PHP with the BOM can not cope, and the above error message ejects, you have to set up your editor that UTF-8 will be saved without BOM.
If your editor does not offer this possibility, you have the following options:
Windows
Here we recommend the Editor Notepad++. This editor is Open Source and a good replacement for Notepad included in Windows, but you also need to explicitly select UTF-8 without BOM here when you save. This is not the default setting of the editor.
OS X und Linux
Here it is quite easy if you know the console and the editor Vim . Open the file with Vim and enter : set nobomb
. Now save the file, and everything will be fine.
Mass assignment of roles using the import
If you want to quickly assign multiple users in a specific role, so you can make this even with the import function. For this purpose, you create an Excel list with first name and surname of the person that should get assigned to the role. If necessary, you can export a list from a different role and do your adjustments there.
This spreadsheet you now choose for the import with selection Existing contacts type Complement. In the next step you assign the mandatories, then the users are imported and the role assignment are created. Due to users were already added and also no changes in field contents are made so far, the role assignments are created quickly and easily.
Move Admidio folder
If you want to move a running Admidio on the FTP server to another folder, , it is possible in a few steps.
- With the help of a FTP program move all adm_ folders and the index.php file to the new folder.
- Now you have to open the file config.php in adm_my_files folder and adjust the variable $g_root_path to the new folder.
- Now call Admidio within the new folder, and log in as a webmaster.
- Now go into the Settings and look at General for both URLs of the home page. If they are also affected by the new folder, you need to modify them to suit.
Now Admidio is running in the new folder.
Insert back link into theme
From time to time it is useful to have a link that takes you back to the previous page. If you need this link, you can place it anywhere in the template file. Open the file adm_themes/simple/templates/index.tpl
and insert the following code snippet at the desired place:
{if $hasPreviousUrl} <!-- Add link to previous page --> <a id="admidio-back-link" class="" href="{$urlAdmidio}/adm_program/system/back.php"><i class="fas fa-arrow-circle-left fa-fw"></i> {$l10n->get('SYS_BACK')}</a> {/if}
In this case, only the link will be displayed if there is also a meaningful URL from a previous page. You can further adjust the visual design via CSS or change the HTML in the code snippet accordingly.