MammothWP Acceptance Logs: hooks and filters

6 actions and 17 filters, read from the source of admin-terms-acceptance at main. Each hook links to the line that fires it.

Actions

Example: mmwp_terms_accepted

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

Action

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.

Parameters of mmwp_terms_record_failed
NameTypeDescription
$user_idint
$version_idint
$db_errorstring

Fired in src/Acceptance/AcceptanceRepository.php#L93(opens in a new tab) (AcceptanceRepository::record()).

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

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.

Parameters of mmwp_terms_can_manage
NameTypeDescription
$allowedbool
$user_idint

Fired in src/Support/ManagerAccess.php#L96(opens in a new tab) (ManagerAccess::can_manage()).

Filter

mmwp_terms_drop_data_on_uninstall

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
NameTypeDescription
$dropboolWhether to delete the evidence.

Fired in uninstall.php#L77(opens in a new tab).

Filter

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.

Parameters of mmwp_terms_public_api_enabled
NameTypeDescription
$enabledboolDefaults to true.

Fired in src/Api/PublicRestController.php#L68(opens in a new tab) (PublicRestController::register_routes()).

Filter

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.

Parameters of mmwp_terms_trusted_proxies
NameTypeDescription
$proxiesstring[]IP addresses or CIDR ranges.

Fired in src/Support/ClientIp.php#L114(opens in a new tab) (ClientIp::trusted_proxies()).

Filter

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.

Parameters of mmwp_terms_version_meta
NameTypeDescription
$metaarray<string,mixed>Version metadata so far.
$contentstringThe content being published.
$hashstringIts version hash.

Fired in src/Versioning/VersionArchivist.php#L135(opens in a new tab) (VersionArchivist::publish()).