Actions
Example: mmwp_terms_accepted
add_action( 'mmwp_terms_accepted', function ( $user_id, $version_hash, $acceptance_id, $version_id ) {
// Your code.
}, 10, 4 );
Action
Fires right after an acceptance is persisted.
Parameters of mmwp_terms_accepted | Name | Type | Description |
$user_id | int | |
$version_hash | string | |
$acceptance_id | int | |
$version_id | int | |
Fired in src/Acceptance/AcceptanceService.php#L190↗(opens in a new tab) (AcceptanceService::record_acceptance()).
Action
Fires when the settings page is saved.
Parameters of mmwp_terms_content_saved | Name | Type | Description |
$version_hash | string | |
$meta | array<string,mixed> | Version number, effective date, change summary. |
Fired in src/Admin/SettingsPage.php#L167↗(opens in a new tab) (SettingsPage::handle_save()).
Action
Fires when an acceptance could not be persisted.
The user has NOT been recorded as accepting and their meta is untouched. Hook this to alert someone: silently losing acceptance evidence is the worst failure this plugin has.
Parameters of mmwp_terms_record_failed | Name | Type | Description |
$user_id | int | |
$version_id | int | |
$db_error | string | |
Fired in src/Acceptance/AcceptanceRepository.php#L93↗(opens in a new tab) (AcceptanceRepository::record()).
Action
Parameters of mmwp_terms_skipped | Name | Type | Description |
$user_id | int | |
Fired in src/Acceptance/AcceptanceService.php#L203↗(opens in a new tab) (AcceptanceService::record_skip()).
Action
Fires when the terms content hash changes.
Parameters of mmwp_terms_version_changed | Name | Type | Description |
$old_hash | string | |
$new_hash | string | |
Fired in src/Acceptance/AcceptanceService.php#L94↗(opens in a new tab) (AcceptanceService::refresh_current_hash()).
Action
Fires once a new terms version has been archived and made active.
Parameters of mmwp_terms_version_published | Name | Type | Description |
$version_id | int | |
$version_hash | string | |
Fired in src/Versioning/VersionArchivist.php#L235↗(opens in a new tab) (VersionArchivist::publish()).
Filters
Example from the source docblock: mmwp_terms_version_meta
add_filter( 'mmwp_terms_version_meta', function ( array $meta, $content ) {
// Someone published deliberately — don't second-guess them.
if ( 'settings' === ( $meta['source'] ?? '' ) || ! empty( $meta['version_number'] ) ) {
return $meta;
}
$doc = my_legal_api_fetch();
$meta['version_number'] = $doc['version'];
$meta['effective_date'] = $doc['effective_from'];
$meta['change_summary'] = $doc['changelog'];
return $meta;
}, 10, 2 );
Filter
Filters whether a user may manage the terms plugin.
The escape hatch for sites that genuinely want to map this onto a capability or an external permission system. Note it cannot re-enable anything while the UI kill-switch is on — that check runs first, above.
Parameters of mmwp_terms_can_manage | Name | Type | Description |
$allowed | bool | |
$user_id | int | |
Fired in src/Support/ManagerAccess.php#L96↗(opens in a new tab) (ManagerAccess::can_manage()).
Filter
Filters the raw terms & conditions content used both for display and for computing the version hash.
Parameters of mmwp_terms_content_source | Name | Type | Description |
$default | string | The content saved on the settings page. |
Fired in src/Content/ContentSource.php#L59↗(opens in a new tab) (ContentSource::get_content()).
Filter
Since 1.0.0
Whether to delete the acceptance log, version archive, audit events and per-user acceptance markers when the plugin is deleted.
Defaults to the stored choice, which is false (keep) unless the site owner explicitly chose to delete. After deletion no acceptance can be reproduced or proved, so only return true deliberately.
Parameters of mmwp_terms_drop_data_on_uninstall | Name | Type | Description |
$drop | bool | Whether to delete the evidence. |
Fired in uninstall.php#L77↗(opens in a new tab).
Filter
Filters the users offered when appointing a manager.
Parameters of mmwp_terms_eligible_managers | Name | Type | Description |
$users | \WP_User[] | |
Fired in src/Support/ManagerAccess.php#L140↗(opens in a new tab) (ManagerAccess::eligible_users()).
Filter
Filters whether the plugin's management UI is available at all.
Returning false hides every admin screen from everyone, managers included. The acceptance flow itself keeps running.
Parameters of mmwp_terms_enable_admin_ui | Name | Type | Description |
$enabled | bool | |
Fired in src/Support/AdminUi.php#L50↗(opens in a new tab) (AdminUi::is_enabled()).
Filter
Parameters of mmwp_terms_excluded_roles | Name | Type | Description |
$roles | string[] | Role slugs to exclude from the gate. |
Fired in src/Scope/RoleScope.php#L71↗(opens in a new tab) (RoleScope::excluded_roles()).
Filter
Parameters of mmwp_terms_excluded_users | Name | Type | Description |
$user_ids | int[] | User IDs to exclude from the gate. |
Fired in src/Scope/RoleScope.php#L86↗(opens in a new tab) (RoleScope::excluded_user_ids()).
Filter
Filters which request header carries the forwarded client IP.
Parameters of mmwp_terms_ip_header | Name | Type | Description |
$header | string | A $_SERVER key, e.g. HTTP_CF_CONNECTING_IP. |
Fired in src/Support/ClientIp.php#L77↗(opens in a new tab) (ClientIp::forwarded_for()).
Filter
Parameters of mmwp_terms_notify_admin_email | Name | Type | Description |
$arg1 | | |
Fired in src/Notifications/CertificateMailer.php#L192↗(opens in a new tab) (CertificateMailer::maybe_notify_admin()).
Filter
Filters the button/label strings shown in the popup.
Parameters of mmwp_terms_popup_strings | Name | Type | Description |
$strings | array<string,string> | |
Fired in src/Frontend/PopupRenderer.php#L91↗(opens in a new tab) (PopupRenderer::maybe_render()).
Filter
Filters whether the public, unauthenticated read routes exist at all.
Returning false unregisters them entirely — they 404 rather than 401, because a site whose terms are internal should not advertise that the endpoint is there.
Parameters of mmwp_terms_public_api_enabled | Name | Type | Description |
$enabled | bool | Defaults to true. |
Fired in src/Api/PublicRestController.php#L68↗(opens in a new tab) (PublicRestController::register_routes()).
Filter
Filters the retention settings.
Parameters of mmwp_terms_retention_settings | Name | Type | Description |
$settings | | |
Fired in src/Retention/RetentionPolicy.php#L61↗(opens in a new tab) (RetentionPolicy::settings()).
Filter
Allows disabling the emailed PDF receipt entirely.
Parameters of mmwp_terms_send_pdf_email | Name | Type | Description |
$enabled | bool | |
$user_id | int | |
Fired in src/Notifications/CertificateMailer.php#L84↗(opens in a new tab) (CertificateMailer::send()).
Filter
Filters the source application identifier stored on each record.
Parameters of mmwp_terms_site_identifier | Name | Type | Description |
$default | string | |
Fired in src/Support/RequestContext.php#L65↗(opens in a new tab) (RequestContext::site_identifier()).
Filter
Parameters of mmwp_terms_skip_duration | Name | Type | Description |
$arg1 | | |
Fired in src/Acceptance/AcceptanceService.php#L196↗(opens in a new tab) (AcceptanceService::record_skip()).
Filter
Filters the proxies whose forwarded-IP header may be trusted.
Empty by default: without this configured the plugin records the connecting address, which behind a proxy is the proxy itself. That is deliberate — an honest wrong-ish value beats a client-spoofable one in an audit log.
Parameters of mmwp_terms_trusted_proxies | Name | Type | Description |
$proxies | string[] | IP addresses or CIDR ranges. |
Fired in src/Support/ClientIp.php#L114↗(opens in a new tab) (ClientIp::trusted_proxies()).
Filter
Filters the version metadata attached to a publication.
This is how a programmatic content source names its own versions. Set `version_number`, `effective_date` (Y-m-d) and `change_summary` to have them recorded; anything left empty is derived, except the effective date, which is simply not recorded.
PRECEDENCE: this filter runs last and wins, per WordPress convention — including over a number typed on the settings screen or passed to the API. That is easy to get wrong in a way that mislabels a legal document, so scope the filter to the sources it is meant for and leave values the caller already supplied alone:
`$meta['source']` is one of settings|filter|api|rest|cli|code.
Parameters of mmwp_terms_version_meta | Name | Type | Description |
$meta | array<string,mixed> | Version metadata so far. |
$content | string | The content being published. |
$hash | string | Its version hash. |
Fired in src/Versioning/VersionArchivist.php#L135↗(opens in a new tab) (VersionArchivist::publish()).