# MammothWP Acceptance Logs: docs

A record of who accepted which version of your terms, and when. Free on wordpress.org.

Generated from admin-terms-acceptance at branch main.

## Install

In wp-admin: Plugins > Add New, search for "MammothWP Acceptance Logs", install and activate. Then go to Settings > Terms & Conditions, write your terms, choose which roles must accept them, then publish the version.

```bash
composer require wpackagist-plugin/mammoth-acceptance-logs
```

1. Download the ZIP of the main branch from github.com/mammothwp/admin-terms-acceptance (Code > Download ZIP).
2. Unzip it and rename the folder to mammothwp-acceptance-logs if GitHub named it admin-terms-acceptance-main, then zip it again.
3. In wp-admin, go to Plugins > Add New > Upload Plugin and choose the ZIP, then activate the plugin.

## Usage snippets

### Download and install

```bash
composer install --no-dev --optimize-autoloader
```

### PHP

```php
// Publish, asking everyone in scope to accept.
$result = mmwp_terms_publish_version( $html, array(
    'version_number' => '2.1',
    'effective_date' => '2026-10-01',
    'change_summary' => 'Clarified section 4.',
) );

if ( is_wp_error( $result ) ) {
    // Duplicate version number, empty content, bad date, or a failed write.
}

// For sync jobs: no-op when the text already matches the active version.
mmwp_terms_publish_version_if_changed( $html, array( 'version_number' => '2.1' ) );

// Re-read the content source now instead of waiting for the daily cron.
$new_version_id = mmwp_terms_refresh();     // null if nothing changed

mmwp_terms_active_version();                // array|null
mmwp_terms_user_status( $user_id );         // accepted|pending|not_required
```

### Public read routes

```
curl https://example.com/wp-json/mmwp/v1/public/version
```

### Example: source the terms from a JSON file instead of the settings page

```php
add_filter( 'mmwp_terms_content_source', function ( string $content ) {
    $path = WP_CONTENT_DIR . '/mmwp-terms/terms.json';
    if ( ! is_readable( $path ) ) {
        return $content;
    }
    $data = json_decode( (string) file_get_contents( $path ), true );
    return (string) ( $data['content'] ?? $content );
} );
```

### Example: exclude WooCommerce customers, keep staff roles gated

```php
add_filter( 'mmwp_terms_excluded_roles', fn ( array $roles ) => array_merge( $roles, [ 'customer' ] ) );
```

### Example: record provider-side delivery status from an ESP webhook

```php
// The plugin cannot poll your provider; wire its webhook to this action.
do_action( 'mmwp_terms_delivery_status_recorded', $acceptance_id, $message_id, 'delivered' );
```

### WP-CLI

```bash
wp mmwp terms get
wp mmwp terms list --limit=10 --format=json
wp mmwp terms show 3
wp mmwp terms publish --content="$(cat terms.html)" --version-number=2.1 --effective-date=2026-10-01 --change-summary="Clarified section 4." --only-if-changed
wp mmwp terms refresh
wp mmwp terms acceptances --version-id=3 --format=csv
wp mmwp terms purge --dry-run        # report evidence; add --force to delete it permanently
```

## In these docs

- [Hooks & filters](https://mammothwp.com/docs/mammoth-acceptance-logs/hooks/)
- [REST & Abilities](https://mammothwp.com/docs/mammoth-acceptance-logs/rest/)
- [Command line](https://mammothwp.com/docs/mammoth-acceptance-logs/cli/)
- [Use cases](https://mammothwp.com/docs/mammoth-acceptance-logs/use-cases/)
