diff --git a/php/class-coauthors-endpoint.php b/php/class-coauthors-endpoint.php index cfeb2c15..d7424265 100644 --- a/php/class-coauthors-endpoint.php +++ b/php/class-coauthors-endpoint.php @@ -216,6 +216,7 @@ public function _format_author_data( $author ): array { 'email' => sanitize_email( $author->user_email ), 'displayName' => esc_html( str_replace( '∣', '|', $author->display_name ) ), 'avatar' => esc_url( get_avatar_url( $author->ID ) ), + 'userType' => esc_html( $author->type ), ); } diff --git a/src/utils.js b/src/utils.js index 4a3f9ec8..cb5e8146 100644 --- a/src/utils.js +++ b/src/utils.js @@ -66,16 +66,20 @@ export const addItemByValue = ( * Format the author option object. * * @param {Object} root0 An author object from the API endpoint. - * @param {Object} root0.displayName Name to display in the UI. - * @param {Object} root0.userNicename The unique username. - * @param {Object} root0.email + * @param {string} root0.id The author ID. + * @param {string} root0.displayName Name to display in the UI. + * @param {string} root0.userNicename The unique username. + * @param {string} root0.email The author's email address. + * @param {string} root0.userType The entity type, either 'wpuser' or 'guest-user'. * * @return {Object} The object containing data relevant to the Coauthors component. */ -export const formatAuthorData = ( { displayName, userNicename, email } ) => { +export const formatAuthorData = ( { id, displayName, userNicename, email, userType } ) => { return { + id, label: `${ displayName } | ${ email }`, display: displayName, value: userNicename, + userType, }; };