Monitoring Additional Folders
UserSpice's page scanner watches a list of folders and auto-registers any new .php
file it finds in them — that's how a brand-new page picks up its row in the pages
table and stops throwing "illegal offset" errors. Out of the box it watches the project root,
users/, and usersc/. If you keep your app code somewhere else, you
need to tell UserSpice about it.
-
01 Recommended
From the dashboard (recommended)
The cleanest way is straight from the admin UI — no file editing, no chance of typos.
- 1Go to Admin Dashboard → Manage → Pages.
- 2At the top of the page, you'll see "UserSpice is currently monitoring the following folders: ..." followed by a Change button.
- 3Click Change, type the folder path (with a trailing slash, e.g.
app/), and click Monitor Folder. - 4Refresh the page. UserSpice immediately rescans and registers any
.phpfiles it finds.
Heads up: the Change button only appears for users in the
$master_accountarray, since this writes toz_us_root.phpon disk. The same modal also lets you remove a folder you no longer want monitored.users/andusersc/can't be removed — they're treated as permanent. -
02 By hand
By editing
z_us_root.phpThe dashboard's "Change" button is just a wrapper around editing one line of
z_us_root.phpin your project root. If you can't use the dashboard (maybe you're not a Master Account, or you're scripting a deploy), edit the file directly.Open
z_us_root.php. The default looks like this:<?php $path=['','users/','usersc/'];Each entry is a folder, relative to the project root, with a trailing slash. The empty string
''means the project root itself. To also monitor anapp/folder, add it:<?php $path=['','users/','usersc/','app/'];Save the file. Visit Manage → Pages in the dashboard and the new folder's PHP files appear in the list automatically.
-
03 Gotchas
Rules and gotchas
- ✓Folders must live inside the project root. You can't monitor a path above the UserSpice install — there's no
../escape. - ✓Trailing slash is required (
app/, notapp). The dashboard's add-folder action rejects entries without one. - ✓The folder must already exist on disk before you add it. UserSpice verifies the path before writing the change.
- ✓
users/andusersc/are permanent. The remove-folder action refuses to take them out of the list. - ✓Use
securePage()in a folder that's not monitored? The page scanner deletes its row on the next sweep, which breaks the permission check. Always add the folder before you start writing protected pages there.
- ✓Folders must live inside the project root. You can't monitor a path above the UserSpice install — there's no