A 7-day telephone shift rota manager for WordPress.
Requires: WordPress 6.0+ · PHP 8.6+ License: MIT (Modified)
- Build reusable weekly shift templates (ACF custom post type, free fields only).
- Apply a template to any week to generate the rota.
- A calendar view in the admin for editing slots and assigning members.
- Assign one member to each slot via a dropdown. The same member can cover different shifts on different days; each slot just holds a single person.
- Rota and assignment data lives in custom database tables behind an interface / factory / repository layer — not a custom post type — so week reads are a single indexed range scan rather than slow meta joins.
- Built on Unity. Trusted
registers its services into Unity's dependency container (the same pattern as
Amber) and sources members directly from Unity's
MemberRepository, filtered to telephone responders. - No shortcodes, no front-end output, no bulletins. Admin-only.
- WordPress 6.0+
- PHP 8.6+
- Unity plugin — required. Trusted boots on Unity's
unity/loadedhook and uses Unity'sMemberRepository. If Unity is not active, Trusted shows an admin notice and does nothing. - Advanced Custom Fields (free) — required for editing templates. Manual slot editing and assignment work without it.
- Install and activate Unity first.
- Copy the
trustedfolder intowp-content/plugins/. - (Optional, for the Composer autoloader) run
composer installinside the folder. Without it, a bundled PSR-4 fallback autoloader is used.psr/containeris provided by Unity at runtime either way. - Activate Trusted in Plugins. This creates two tables:
{prefix}trusted_rotaand{prefix}trusted_assignments.
-
Trusted → Shift Templates → Add Template. Give it a title and fill in the seven day fields. One shift per line:
08:00-12:00 | Morning desk 12:00-16:00 | Afternoon desk 16:00-20:00 | Evening on-callGive every shift a name after the
|. If you leave it off, the time range is used as the name. Each day can hold as many shifts as you like. -
Trusted → Rota Calendar. Pick a week, choose a template, and click Apply template. Applying is non-destructive: shifts that already exist on a date/time are left untouched (their names and assignments are kept), and only new shifts are added — so re-applying never overwrites or duplicates your existing shifts. Tick Replace only when you want to wipe the week first.
-
On any slot, pick a member from the dropdown and click Assign. Each shift holds one member, shown with their name and preferred telephone number (never their email). To swap who's on a shift, remove the current person (×) and assign someone else. The same member can be assigned to other shifts and other days. Add ad-hoc slots per day with + Add shift.
Telephone → Forwarding shows a week of the rota as the call-forwarding hunt group it would make: a table per day, Monday first, each listing that day's forwarding steps in time order — start, end, responder, the number calls divert to, and whether the shift is filled — styled like Tamar's overview, then the numbers they forward to.
- Each shift is a step on its weekday. A filled shift forwards to the responder's telephone. Steps are numbered through the week, earliest first, which is the order a hunt-in-order group rings overlapping windows.
- The forwarding system's day runs 00:00–23:59, and times are shown that way. A shift that straddles midnight is split into two steps for the same person — to 23:59 on its own day, then from 00:00 on the next. A Sunday night shift carries on into Monday, because a hunt group repeats weekly.
- An unfilled shift forwards to voicemail by default. So does one assigned to a member Unity no longer has, or to one with no telephone, since a call cannot reach them either. These steps are flagged Unfilled, with the reason.
The preview works whether or not Tamar is active. The rules are built as
Beacon ForwardingRule and ForwardingTarget models
(Trusted\Forwarding\RotaForwardingProjection), in the shape Tamar's driver
reads and writes.
When Tamar is active, the page also has a Publish to Tamar as "Forward Week
N" button, where N is the week's ISO-8601 number. It is the only thing on the
page that sends anything upstream, and it asks for confirmation first. It
hands the week's rules to Tamar through Tamar's tamar/publish_huntgroup
filter, and Tamar then:
- creates a hunt group called
Forward Week Nin the control panel, or reuses one that already has that name, so publishing a week twice overwrites it; - replaces every row in it with the week's rules, and gives it the ring timeout, announcement, voicemail box and hunting type set under Tamar → Settings → Hunt group settings (from Tamar 1.9.0; by default 90 seconds, none, Voice to Email and hunt in-order);
- makes it the hunt group Tamar's Overview shows.
Calls do not reach the new group until the phone number is pointed at it in the Tamar panel; that step is still done by hand. Old week groups are not deleted.
Publishing needs Trusted's capability (manage_options unless filtered) and
Tamar's beacon_manage_forwarding. The outcome is shown as a notice on the
page.
When Tamar is active, the Rota Calendar has a Check call forwarding
button. It is enabled only while the current week is on screen, and it changes
nothing in Tamar. It reads the hunt group named Forward Week N for the current
week through Tamar's tamar/find_huntgroup filter, compares it with the week's
rota, and shows the result as a notice under the toolbar:
- success when every window forwards where the rota says;
- a warning when there is no hunt group with that name;
- a warning listing each difference when the group exists but does not match: a shift Tamar has no row for, a row the rota has no shift for, a different destination, or a row that is switched off;
- an error when Tamar cannot be read, so an outage is never reported as a missing group.
Only where calls go is compared. The day, start, end and destination of each
window must agree, and the row must be switched on. Labels, ring timeouts and
row order are not compared. A row ticked for several days counts as one window
a day. Any voicemail box counts as voicemail, and numbers are compared by their
digits, with +44 read as 0
(Trusted\Forwarding\HuntgroupComparison, served by
GET trusted/v1/forwarding-check). It needs Trusted's capability and Tamar's
beacon_view_forwarding.
When the check finds the group missing or different, its warning has a Sync
to Tamar button. The button appears only when the week has shifts and Tamar can
publish. After a confirmation it writes the current week's rota to Forward Week N
through tamar/publish_huntgroup, which is the same path as the Forwarding page's
Publish button. Tamar creates the group if need be, replaces every row, and makes
it the group its Overview shows. The group is then read back and compared again
(POST trusted/v1/forwarding-sync). Success is reported only when the read-back
matches; a write Tamar accepted but did not apply still shows as a difference.
Syncing needs Trusted's capability and Tamar's beacon_manage_forwarding.
Nothing syncs on its own. Callers reach the group only once the phone number points at it in the Tamar panel, as with Publish.
Trusted → Developer is a maintenance page for admins, with two destructive tools:
- Delete a week — pick any date and remove every shift (and its assignments) for that whole Monday–Sunday week.
- Clear everything — empty the entire rota: all shifts and all assignments
across every week. Requires typing
DELETEto confirm. Shift templates are left untouched.
Both are nonce-protected, ask for confirmation, and cannot be undone. Hide the
page in production by returning false from the trusted_developer_tools
filter.
ACF's Repeater and Flexible Content fields are Pro only. To allow an
arbitrary number of shifts per day using only free fields, each weekday is a
plain Textarea, one shift per line, parsed by TemplateApplicator. This is
the cleanest free-ACF approach to "multiple shifts in a day".
src/
Core/ TrustedServiceProvider (registers services into Unity's container)
Domain/ Rota, Assignment, Member, Shift (entities & value objects)
Contracts/ RotaRepositoryInterface, AssignmentRepositoryInterface, *FactoryInterface
Factory/ RotaFactory, AssignmentFactory
Repository/ RotaRepository, AssignmentRepository (wpdb / custom tables)
Template/ TemplatePostType, TemplateFields (ACF), TemplateApplicator
Http/ RestController, ForwardingCheckController (trusted/v1 REST namespace)
Forwarding/ RotaForwardingProjection (a week of the rota as Beacon forwarding rules),
HuntgroupComparison (those rules against a hunt group's)
Admin/ CalendarPage, ForwardingPage, DeveloperPage, Assets
Support/ Database (tables + dbDelta), MemberPresenter (Unity → Trusted Member)
Plugin.php Boots on unity/loaded; wires WordPress hooks
- Rota = one shift slot on one date. A week's rota is the set of rows in that date range. Assignment links a member (by Unity member id) to a slot.
- Repositories are typed against interfaces and hydrate entities through the factories. They are resolved lazily from Unity's container at request time — after Unity has finished loading.
Trusted does not own a container. Like AmberServiceProvider, it registers its
services into Unity's container:
- On
unity/register_services,TrustedServiceProvider::register()binds Trusted's repositories, factories, applicator and REST controller. Their factory closures resolve dependencies — including Unity'sUnity\Members\Interfaces\MemberRepository— from the same container. - On
unity/loaded,Plugin::boot()wires the WordPress hooks (CPT, admin menu, assets, REST routes).
There is no Trusted member factory any more. Members come straight from
Unity's MemberRepository:
RestController::getMembers()callsfindAll()and keeps only members whereisTelephoneResponder()is true, mapping each viaMemberPresenter(getAnonymousName → name,getPersonalEmail → email, andgetLandlineNumberwhengetPreferredContact()is Landline, otherwisegetMobileNumber→ telephone), sorted by name.AssignmentRepositoryresolves the member for each assignment withfindById(). This lookup is not responder-filtered, so historical assignments still display members who are no longer responders.
| Filter | Purpose | Default |
|---|---|---|
trusted_capability |
Capability required to use Trusted & the REST API | manage_options |
trusted_developer_tools |
Show the Developer admin page (week bulk-delete) | true |
The Member value object exposes name, email and telephone. To change the
member source, register a different Unity\Members\Interfaces\MemberRepository
in Unity's container — Trusted consumes whatever Unity provides.
All routes require the Trusted capability.
| Method | Route | Body |
|---|---|---|
| GET | /week/{YYYY-MM-DD} |
— |
| POST | /rota |
date,start,end,label (all required) |
| PATCH | /rota/{id} |
partial slot |
| DELETE | /rota/{id} |
— |
| POST | /assignment |
rota_id, member_id (one member per slot; member_ids[] accepted, first id used), notes? |
| DELETE | /assignment/{id} |
— |
| GET | /members?search= |
— |
| GET | /templates |
— |
| POST | /apply-template |
template_id,week_start,replace? |
Install the dev dependencies and run the suite from the plugin directory:
composer install| Command | Description |
|---|---|
composer test |
Run the Pest test suite |
composer phpstan |
Run PHPStan static analysis |
The suite is written in Pest (on PHPUnit) with Mockery and bleedingdeacons/wp-mocks — the suite's shared WordPress test doubles, a state-backed stub layer over Brain Monkey. Line coverage is reported to Coveralls on every CI run — see the coverage badge at the top of this file.