Modules add new features to the panel: new pages in the admin area, for clients or on the website, payment methods, notifications, automatic tasks. A module is a .mhmod archive (zip) with two required files.
1. module.json
{
"slug": "hello-world",
"name": "Salut, lume",
"name_en": "Hello world",
"version": "1.0.0",
"author": "Your name",
"requires_panel": 353
}2. main.php
<?php
mh_menu('admin', 'Salut, lume', 'Hello world', '', 'star');
mh_route('admin', '', function () {
mh_page(mh_t('Salut, lume', 'Hello world'), '<p>' . mh_t('Primul meu modul!', 'My first module!') . '</p>');
});3. The archive and installing it
- Put the two files in a zip archive and change the extension to
.mhmod. - In the admin area, open Modules, press Upload module, choose the archive and turn the module on.
- "Hello world" appears in the menu.
Good to know
- Use
mh_t('Romanian text', 'English text')for every text you show, so the module works in both languages. - If the module has a serious error, the panel turns it off automatically and shows you what happened: the rest of the panel keeps working.
- The full documentation, with all functions, is in the admin area, under Modules → For developers.
Made a module? Post it in a new topic here, attach the archive and let the community try it. The ✓ / ✗ under the topic shows whether it works.
MasterHub