# MammothWP Acceptance Logs: hooks and filters

Read from admin-terms-acceptance at main.

## Actions

Example (mmwp_terms_accepted):

```php
add_action( 'mmwp_terms_accepted', function ( $user_id, $version_hash, $acceptance_id, $version_id ) {
    // Your code.
}, 10, 4 );
```

### mmwp_terms_accepted

Action. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_accepted

Fires right after an acceptance is persisted.

| Name | Type | Description |
| --- | --- | --- |
| $user_id | int |  |
| $version_hash | string |  |
| $acceptance_id | int |  |
| $version_id | int |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Acceptance/AcceptanceService.php#L190

### mmwp_terms_content_saved

Action. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_content_saved

Fires when the settings page is saved.

| Name | Type | Description |
| --- | --- | --- |
| $version_hash | string |  |
| $meta | array<string,mixed> | Version number, effective date, change summary. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Admin/SettingsPage.php#L167

### mmwp_terms_record_failed

Action. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_record_failed

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.

| Name | Type | Description |
| --- | --- | --- |
| $user_id | int |  |
| $version_id | int |  |
| $db_error | string |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Acceptance/AcceptanceRepository.php#L93

### mmwp_terms_skipped

Action. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_skipped

| Name | Type | Description |
| --- | --- | --- |
| $user_id | int |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Acceptance/AcceptanceService.php#L203

### mmwp_terms_version_changed

Action. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_version_changed

Fires when the terms content hash changes.

| Name | Type | Description |
| --- | --- | --- |
| $old_hash | string |  |
| $new_hash | string |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Acceptance/AcceptanceService.php#L94

### mmwp_terms_version_published

Action. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_version_published

Fires once a new terms version has been archived and made active.

| Name | Type | Description |
| --- | --- | --- |
| $version_id | int |  |
| $version_hash | string |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Versioning/VersionArchivist.php#L235

## Filters

Example (mmwp_terms_version_meta):

```php
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 );
```

### mmwp_terms_can_manage

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_can_manage

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.

| Name | Type | Description |
| --- | --- | --- |
| $allowed | bool |  |
| $user_id | int |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Support/ManagerAccess.php#L96

### mmwp_terms_content_source

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_content_source

Filters the raw terms & conditions content used both for display and for computing the version hash.

| Name | Type | Description |
| --- | --- | --- |
| $default | string | The content saved on the settings page. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Content/ContentSource.php#L59

### mmwp_terms_drop_data_on_uninstall

Filter, since 1.0.0. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_drop_data_on_uninstall

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.

| Name | Type | Description |
| --- | --- | --- |
| $drop | bool | Whether to delete the evidence. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/uninstall.php#L77

### mmwp_terms_eligible_managers

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_eligible_managers

Filters the users offered when appointing a manager.

| Name | Type | Description |
| --- | --- | --- |
| $users | \WP_User[] |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Support/ManagerAccess.php#L140

### mmwp_terms_enable_admin_ui

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_enable_admin_ui

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.

| Name | Type | Description |
| --- | --- | --- |
| $enabled | bool |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Support/AdminUi.php#L50

### mmwp_terms_excluded_roles

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_excluded_roles

| Name | Type | Description |
| --- | --- | --- |
| $roles | string[] | Role slugs to exclude from the gate. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Scope/RoleScope.php#L71

### mmwp_terms_excluded_users

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_excluded_users

| Name | Type | Description |
| --- | --- | --- |
| $user_ids | int[] | User IDs to exclude from the gate. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Scope/RoleScope.php#L86

### mmwp_terms_ip_header

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_ip_header

Filters which request header carries the forwarded client IP.

| Name | Type | Description |
| --- | --- | --- |
| $header | string | A $_SERVER key, e.g. HTTP_CF_CONNECTING_IP. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Support/ClientIp.php#L77

### mmwp_terms_notify_admin_email

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_notify_admin_email

| Name | Type | Description |
| --- | --- | --- |
| $arg1 |  |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Notifications/CertificateMailer.php#L192

### mmwp_terms_popup_strings

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_popup_strings

Filters the button/label strings shown in the popup.

| Name | Type | Description |
| --- | --- | --- |
| $strings | array<string,string> |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Frontend/PopupRenderer.php#L91

### mmwp_terms_public_api_enabled

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_public_api_enabled

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.

| Name | Type | Description |
| --- | --- | --- |
| $enabled | bool | Defaults to true. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/PublicRestController.php#L68

### mmwp_terms_retention_settings

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_retention_settings

Filters the retention settings.

| Name | Type | Description |
| --- | --- | --- |
| $settings |  |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Retention/RetentionPolicy.php#L61

### mmwp_terms_send_pdf_email

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_send_pdf_email

Allows disabling the emailed PDF receipt entirely.

| Name | Type | Description |
| --- | --- | --- |
| $enabled | bool |  |
| $user_id | int |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Notifications/CertificateMailer.php#L84

### mmwp_terms_site_identifier

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_site_identifier

Filters the source application identifier stored on each record.

| Name | Type | Description |
| --- | --- | --- |
| $default | string |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Support/RequestContext.php#L65

### mmwp_terms_skip_duration

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_skip_duration

| Name | Type | Description |
| --- | --- | --- |
| $arg1 |  |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Acceptance/AcceptanceService.php#L196

### mmwp_terms_trusted_proxies

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_trusted_proxies

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.

| Name | Type | Description |
| --- | --- | --- |
| $proxies | string[] | IP addresses or CIDR ranges. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Support/ClientIp.php#L114

### mmwp_terms_version_meta

Filter. Anchor: https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/#mmwp_terms_version_meta

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.

| Name | Type | Description |
| --- | --- | --- |
| $meta | array<string,mixed> | Version metadata so far. |
| $content | string | The content being published. |
| $hash | string | Its version hash. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Versioning/VersionArchivist.php#L135
