Automattic\WooCommerce\Internal\Email
EmailLogger::resolve_recipient
Resolve a recipient email string to an identifier safe for logging.
Each address is mapped to the corresponding WordPress username when an account exists, or to the string 'guest' for addresses with no associated account. This avoids storing plain email addresses in logs while still giving support teams a useful identifier for troubleshooting.
Метод класса: EmailLogger{}
Хуков нет.
Возвращает
string. Comma-separated usernames or 'guest' labels.
Использование
// private - только в коде основоного (родительского) класса $result = $this->resolve_recipient( $recipient ): string;
- $recipient(строка) (обязательный)
- Comma-separated recipient email string from WC_Email::get_recipient().
Код EmailLogger::resolve_recipient() EmailLogger::resolve recipient WC 11.2.2
private function resolve_recipient( string $recipient ): string {
if ( '' === $recipient ) {
return 'guest';
}
$labels = array_map(
function ( string $email ): string {
$user = get_user_by( 'email', trim( $email ) );
return $user instanceof WP_User ? $user->user_login : 'guest';
},
explode( ',', $recipient )
);
return implode( ', ', $labels );
}