Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
287 stars 205 forks source link

Author archive: ensure queried object ID is an int #966

Closed GaryJones closed 11 months ago

GaryJones commented 11 months ago

Description

The fix_author_page() method amends the content of author archives. It modifies the queried object data if it's a real user or a guest author. The WP_User::get_data_by() method uses $wpdb->get_row() which makes a stdClass, and \CoAuthors_Guest_Authors::get_guest_author_by() casts an array to a stdObject object on return. As such, the ID property under both conditions becomes a string. This differs from the default queried object data when fix_author_page() is not run.

Fixes #645.

Steps to Test

In fix_author_page(), add some var_dump() to show that the ID is a string. After patch, see that it is an integer.