Automattic / Co-Authors-Plus

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

Matching IDs can cause WP Users to pick up Guest Author avatars in WP Admin #907

Closed laurelfulford closed 1 year ago

laurelfulford commented 1 year ago

When a WP User and Guest Author share the same ID, the WP User can pick up the wrong avatar in the backend.

Steps to reproduce:

  1. Start with a test site that has a Guest Author and WP User that share the same ID. If you don't already have one, the quickest way to recreate is:
    • Set up a new site.
    • Before adding/importing any posts, install CoAuthors Plus and create a Guest Author. Usually they will have an ID around 5-6. This is necessary because Guest Authors share the same ID pool as other post types.
    • Create 5-6 regular WP Users, until you have one whose ID matches your Guest Author.
  2. Give your "ID twin" Guest Author an avatar.
  3. You can also give your "ID twin" WP User an email address that's associated with a Gravatar, but it's not necessary.
  4. View the user list under WP Admin > Users, or view the individual profile of your "ID twin" WP User. Note that the avatar its using is the one assigned to your Guest Author.

Screenshots

Guest author settings:

image

"ID twin" WP User on the Users screen:

image

Actual avatar the WP User should be using:

image

davidvexel commented 1 year ago

Having this same issue and I think it's because the filter in filter_pre_get_avatar_url is assuming that the $id parameter sent is an Author ID, which is incorrect, I'm seeing the user ID there.

https://github.com/Automattic/Co-Authors-Plus/blob/master/co-authors-plus.php#L1825-L1840

GaryJones commented 1 year ago

Fixed in #960.