=== Happy Dog Platform ===
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.txt
Requires at least: 5.5
Tested up to: 7.1
Stable tag: 4.0.0
Requires PHP: 7.4

Hardening, update email routing, and support details for the WordPress sites maintained by Happy Dog and its partners.

== Description ==

A must-use plugin: it is always active and cannot be turned off from the dashboard. It is made of modules, all on by default:

* `author-archives`: Answers author archives (including `?author=1`) with a 404, as their URLs contain login names. Also removes the core and Yoast SEO author sitemaps, and the author from oEmbed responses.
* `dashboard`: Removes the WordPress Events and News widget, and adds a widget saying who maintains the site and how to reach them.
* `email-redirector`: Sends recovery mode and automatic update emails to Happy Dog instead of the site's administration email address, and does not send them at all outside production. Formerly the Happy Dog Email Redirector plugin.
* `file-editing`: Turns off the theme and plugin file editors (`DISALLOW_FILE_EDIT`). Plugin and theme updates still work.
* `generator`: Removes the WordPress version from the generator tag in pages and feeds.
* `login-errors`: The login form gives the same error for an unknown account and a wrong password, and the lost password form answers a request for an unknown account the same way as for a real one.
* `search-visibility`: Asks search engines not to index any site whose environment type is not `production`.
* `user-enumeration`: Removes the REST API users routes, and users in WPGraphQL, for signed out visitors.
* `xmlrpc`: Turns off XML-RPC. Sites using Jetpack or the WordPress mobile apps need it.

= Email redirector =

These emails are redirected:

* Recovery mode emails ("Your Site is Experiencing a Technical Issue")
* Automatic core update emails, including failed updates and new versions being available
* Automatic plugin and theme update emails
* The debug email sent after automatic updates on development versions of WordPress

An email is only redirected when it is still addressed to the WordPress default recipient. If another plugin, or the `RECOVERY_MODE_EMAIL` constant, has already changed the recipient, the email is left alone.

These emails are not sent at all when the site's environment type is not `production`. WordPress treats a site as `production` unless the `WP_ENVIRONMENT_TYPE` constant says otherwise, so staging and local sites must set it.

Emails handled by this module carry an `X-HDWP-Email-Type` header naming the type of email (`recovery-mode`, `core-update`, `plugin-theme-update`, or `update-debug`), which can be used for filtering.

== Installation ==

Copy `hdwp-platform.php` and the `hdwp-platform` directory into `wp-content/mu-plugins/`. WordPress only loads the PHP files at the top of that directory, so both are needed.

Remove the Happy Dog Email Redirector plugin afterwards. It does no harm while both are installed, but it is no longer needed.

== Configuration ==

All settings are constants in wp-config.php.

Turn modules off for a site:

`define( 'HDWP_PLATFORM_DISABLED_MODULES', [ 'xmlrpc', 'author-archives' ] );`

Send redirected emails somewhere other than team@happydog.digital:

`define( 'HDWP_PLATFORM_EMAIL_RECIPIENT', 'someone@example.com' );`

Change the support details in the dashboard widget, for sites maintained under another name:

`define( 'HDWP_PLATFORM_SUPPORT_NAME', 'Hoist' );`
`define( 'HDWP_PLATFORM_SUPPORT_EMAIL', 'support@example.com' );`
`define( 'HDWP_PLATFORM_SUPPORT_URL', 'https://example.com' );`

Turn the file editors back on:

`define( 'DISALLOW_FILE_EDIT', false );`

To see what the plugin is doing on a site, run `wp hdwp-platform status`.

== Changelog ==

= 4.0.0 =
* The Happy Dog Email Redirector plugin becomes the Happy Dog Platform must-use plugin, with the email redirector as one of its modules.
* The email redirector's constants are renamed: `HDWP_EMAIL_REDIRECTOR_RECIPIENT` is now `HDWP_PLATFORM_EMAIL_RECIPIENT`, and `HDWP_EMAIL_REDIRECTOR_EMAIL_TYPE_HEADER` is now `HDWP_PLATFORM_EMAIL_TYPE_HEADER`. The header itself is still `X-HDWP-Email-Type`.
* New modules: author-archives, dashboard, file-editing, generator, login-errors, search-visibility, user-enumeration, and xmlrpc.
