1. What this module does
Module & Theme Lock refuses chosen Back Office actions — installing, updating, enabling, disabling and uninstalling modules, changing or importing themes, the Performance switches and module positions — for every employee, SuperAdmin included, in every shop. A lock is switched off only with the module's password, created at random and shown once. One click on "Update all" or the wrong module disabled can no longer take your live shop down, and a stolen Back Office account cannot install a backdoor module.
Works with PrestaShop 1.7.8, 8.x and 9.x (PHP 7.2.5 or newer), with the Classic and Hummingbird themes and with multistore.
2. Installation
- Download the module from My account → Order history at addonspresta.com.
- In your Back Office, open Modules → Module Manager and click Upload a module.
- Drop the
ap_modulelock_v1.0.0.zipfile and wait for the confirmation. - Click Configure on the module card.
If you have shell access, you can also unpack the zip into modules/ and run, from the shop folder:
php bin/console prestashop:module install ap_modulelock
rm -rf var/cache/prod var/cache/dev
Right after installation every lock is on except Module positions, and the configuration page shows the password:
- Open the configuration page as a SuperAdmin: only a SuperAdmin sees the password. Other employees see that a new password is waiting.
- Save the password (16 characters, in the form
XXXX-XXXX-XXXX-XXXX) in a password manager. - Click I have saved the password, hide it. The password is deleted from the shop for good and never shown again; from now on every change of the locks needs it.
The module folder modules/ap_modulelock/ must be writable by the web server: the module keeps its seal file
there (see "How it works"). Otherwise the configuration page shows a warning.
3. How it works
The module checks every Back Office request before PrestaShop runs it. When the request would run a locked action, the module answers it itself and the action never happens. You see the refusal where you clicked: a red message in the Module Manager, a message at the top of the themes, Performance and Positions pages, or a short error page with a Back link. The message reads:
Refused by Module & Theme Lock: this action is locked. To allow it, switch its lock off on the configuration page of Module & Theme Lock (the password is needed).
Every refusal by a signed-in employee is written to the list of latest events on the configuration page and to Advanced Parameters → Logs.
The locks apply to everybody: PrestaShop's permissions do not matter, a SuperAdmin is refused like any other employee, and the locks protect every shop of a multistore at once.
Self-protection. While any lock is on, the module cannot be disabled, uninstalled, reset, deleted or updated, and "Disable non built-in modules" cannot be used (it would switch this module off with every other non-native module), whatever switch these actions belong to. The refusal then says that the module cannot be switched off while any of its locks is on. With every lock off the module does nothing at all, so whoever knows the password can always remove it.
Code locks. A module can do anything in the shop, including switching this module's locks off. So allowing new module code allows everything, and the module treats it that way:
- uploading any module ZIP file needs both Installing modules and Updating modules off, because PrestaShop extracts the whole file into the modules folder and one file can add a module and replace another one;
- an install or update from a location the module cannot check (an Addons download, a URL) also needs both off;
- a theme that brings its own modules needs both off as well;
- whatever the module cannot read — a damaged ZIP file, a theme it cannot check, an unreadable request — counts as the worst case.
Seal. The module keeps its settings sealed with the shop's secret key and a random value in the file
modules/ap_modulelock/seal-nonce, renewed on every save. If the locks or the password are changed anywhere else
than on the configuration page — in the database, through the Webservice, by a theme's settings, or by restoring an
older copy of the database — the seal breaks: every lock is on, no password is accepted, and the configuration page
says why, until you create the reset file (see "Lost password" in the FAQ). Deleting seal-nonce, for example by a
deployment that mirrors the module folder, has the same effect.
What the module does not stop. It locks the Back Office pages. It does not stop bin/console commands, the
Webservice (/api/), the PrestaShop 9 Admin API (/admin-api/), AI or MCP tools of other modules on the
storefront, changes over FTP, SSH or in the database, or the fixed dependencies some native modules install for
themselves (ps_accounts, ps_mbo). It does not lock module configuration pages, the logo or anything else not
listed in this manual, and it sends no e-mails. Whoever has the shop's files can always remove it.
The module adds nothing to your storefront and does not connect to addonspresta.com or any other server.
4. Features and settings
Open Modules → Module Manager → Module & Theme Lock → Configure. The Help box at the top links this manual, the module page at addonspresta.com and our support address, and shows the installed version.
Password
The panel below the Help box shows:
- right after installation or a reset — the password in large type and the button I have saved the password, hide it, for a SuperAdmin only;
- once the password is hidden — how to save a change and how to reset a lost password;
- when the seal is broken — that every lock is on and no password is accepted until the reset file;
- always — the note that the module cannot be disabled, uninstalled, reset or updated while any lock is on.
Locks
One switch per lock; Yes means the actions are refused. Each switch has its description on the page.
Installing modules
The Install buttons of the Module Manager, the modules a theme installs and every module ZIP file upload, also through the AI tools of PrestaShop 9 (ps_mcp_server, ps_ask_ai). Default: on.
Updating modules
The Update buttons, Update all and the updates offered by ps_mbo. A module ZIP file upload needs this lock and Installing modules off. Default: on.
Enabling and disabling modules
Enable and Disable, also on mobile devices, one by one and in bulk; the modules a theme enables or disables; the modules copied into an existing shop of a multistore. Default: on.
Uninstalling and resetting modules
Uninstall, Reset and Delete, one by one and in bulk, and the modules a theme resets. Default: on.
Changing the theme
Use this theme in Design → Theme & Logo, and another theme for one shop in Advanced Parameters → Multistore. The modules the theme installs, enables, disables or hooks need their own locks off too. Default: on.
Adding and deleting themes
Importing a theme (ZIP file, URL or FTP folder), a child theme, deleting a theme, choosing or resetting its page layouts and adapting it to right-to-left languages. A theme with modules also needs the module install and update locks off. Default: on.
Performance switches
Disable non built-in modules (on 1.7.8: Disable non PrestaShop modules) and Disable all overrides in Advanced Parameters → Performance, also when a theme sets them. A plain save of the debug mode with these two unchanged is not refused. Default: on.
Module positions
Transplanting, unhooking and moving modules and switching a hook on or off in Design → Positions, the positions a theme sets and the modules copied into an existing shop of a multistore. Default: off, because arranging blocks is everyday work.
Moving a module by drag and drop is refused without a message: after a reload of the page the order is unchanged.
Password field
Below the switches, once the password is hidden: every save needs it. Case, spaces and dashes do not matter. A wrong password saves nothing and keeps your switches on the screen. After 5 wrong passwords in 15 minutes no password is checked for the rest of those 15 minutes, for every employee.
While the password is still shown, the SuperAdmin who sees it saves without it.
Latest events
The last 20 events of the module: refused actions with the employee who tried them, changed locks, wrong passwords,
the password hidden or reset. The full list is in Advanced Parameters → Logs, object type ApModulelock.
5. Multistore
The locks and the password are the same for the whole installation, whatever shop is selected in the Back Office header: modules and themes belong to the installation, so one set of locks protects every shop. Only an employee who manages all shops can save the locks; only a SuperAdmin sees the password and can hide it. One licence covers every shop of the installation.
6. Uninstall
While any lock is on, the module cannot be disabled or uninstalled:
- On its configuration page switch every lock off, enter the password and click Save.
- In Modules → Module Manager → Module & Theme Lock, click Uninstall. The module removes its settings and its seal file; its entries in Advanced Parameters → Logs stay.
Disable keeps the settings; nothing is locked while the module is disabled.
If you no longer have the password, reset it first (see the FAQ), or delete the folder modules/ap_modulelock/
over FTP and then empty the folder var/cache/ of your shop.
7. FAQ and troubleshooting
I lost the password.
Create an empty file named reset-password in the folder modules/ap_modulelock/ over FTP, then open the
configuration page. The module deletes the file and shows a new password to a SuperAdmin; the locks keep their
state. Only someone with access to the shop's files can do this. If the page says the file cannot be deleted, check
the permissions of the module folder.
Every lock is on and no password is accepted.
The seal is broken: the settings were changed outside the configuration page (in the database, through the
Webservice, by a theme, by restoring an older database), or the file seal-nonce was deleted. Create the
reset-password file as above: you get a new password, every lock stays on, and you can switch them off again
with the new password.
The Module Manager shows "Refused by Module & Theme Lock". The action you clicked is locked. Switch its lock off on the configuration page (password needed), do the action, then switch the lock back on.
I cannot disable, uninstall or update Module & Theme Lock. That is the self-protection: while any lock is on, the module refuses to be switched off or replaced, otherwise a single click could remove every lock. Switch every lock off first.
Using another theme is refused although Changing the theme is off. Using a theme also applies what the theme asks for: installing, enabling or disabling modules, hooking them to positions, Performance settings. Each of these needs its own lock off — often Enabling and disabling modules and Module positions, sometimes Installing modules. The event in Latest events names the operation that was refused. A theme that lists this module among the modules to disable is refused by the self-protection.
Why does uploading a module ZIP file need two locks off? PrestaShop extracts the whole ZIP file into the modules folder, so one file can add a new module and replace an existing one, and the code of a module can do anything, including switching these locks off. Every module upload therefore needs Installing modules and Updating modules off.
A module was installed with bin/console (or a theme changed through the Webservice) although the lock is on. The module locks the Back Office pages only. Commands on the server, the Webservice, the PrestaShop 9 Admin API and the database are outside its reach; protect them with server access and Webservice keys you trust.
The page warns that the module folder is not writable.
The module cannot keep its seal file. Changes of its settings in the database are still detected, but not an older
copy of the settings put back. Make modules/ap_modulelock/ writable for the web server.
The shop runs on several servers or is deployed from git.
Keep the file modules/ap_modulelock/seal-nonce when you deploy and share the module folder between servers. A
deployment that deletes it, or servers with different copies of it, break the seal and lock everything until the
reset file.
After "Update all", every module was updated except Module & Theme Lock. "Update all" updates the modules one by one. While any lock is on, the update of Module & Theme Lock itself is refused by the self-protection; the other modules are updated when Updating modules is off. To update this module, switch every lock off first (see "Updates and support").
8. Updates and support
Updates are free for life: download new versions from My account → Order history at addonspresta.com. Because the module protects itself, switch every lock off first, upload the new version like a new module, then switch the locks back on. The password and the locks are kept. The module's code passes our AI-assisted security audit.
Support is included for 12 months from your order: write to mail@addonspresta.com or use the contact form at addonspresta.com (Monday to Friday, 10:00–16:00; we usually answer within 2 business days). Please include your PrestaShop version, the module version, the steps that lead to the problem and the events of the configuration page.