[Bezeichnung, Erklaerung] fuer die Einstellungen. */ public static function arten(): array { return [ 'neuer_benutzer_admin' => [__('Admin: new user registered', 'purehost-send-mails'), __('WordPress tells the administrator about every new user account.', 'purehost-send-mails')], 'passwort_admin' => [__('Admin: user reset their password', 'purehost-send-mails'), __('WordPress tells the administrator when a user has reset their password.', 'purehost-send-mails')], 'update_erfolg' => [__('Admin: successful automatic updates', 'purehost-send-mails'), __('Reports about successful automatic updates of WordPress, plugins and themes. Failed updates are still reported.', 'purehost-send-mails')], 'passwort_geaendert_nutzer' => [__('User: password was changed', 'purehost-send-mails'), __('Confirmation to the user after a password change. Security notice: it warns users if someone else changed their password.', 'purehost-send-mails')], 'email_geaendert_nutzer' => [__('User: email address was changed', 'purehost-send-mails'), __('Notice to the old address after an email change. Security notice: it warns users if someone else took over their account.', 'purehost-send-mails')], ]; } public static function registrieren(): void { $aus = array_flip((array) Einstellungen::wert('systemmails_aus')); if (isset($aus['neuer_benutzer_admin'])) { add_filter('wp_send_new_user_notification_to_admin', '__return_false'); } if (isset($aus['passwort_admin'])) { add_action('init', static function (): void { remove_action('after_password_reset', 'wp_password_change_notification'); }); } if (isset($aus['update_erfolg'])) { add_filter('auto_core_update_send_email', static fn($senden, $art) => $art === 'success' ? false : $senden, 10, 2); add_filter('auto_plugin_update_send_email', [self::class, 'nurFehler'], 10, 2); add_filter('auto_theme_update_send_email', [self::class, 'nurFehler'], 10, 2); } if (isset($aus['passwort_geaendert_nutzer'])) { add_filter('send_password_change_email', '__return_false'); } if (isset($aus['email_geaendert_nutzer'])) { add_filter('send_email_change_email', '__return_false'); } } /** Update-Mail fuer Plugins/Themes nur, wenn ein Update fehlgeschlagen ist. */ public static function nurFehler($senden, $ergebnisse) { foreach ((array) $ergebnisse as $e) { $r = is_object($e) ? ($e->result ?? null) : null; if ($r === false || $r === null || is_wp_error($r)) { return $senden; } } return false; } }