Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix avatar collision on profile, post and edit screens #996

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
9 changes: 9 additions & 0 deletions php/class-coauthors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,15 @@ public function filter_pre_get_avatar_data_url( $args, $id ) {
return $args;
}

// Do not filter on the post list screen, profile screen, and post takeover pop-up.
if ( isset( $current_screen->base ) && ( 'post' === $current_screen->base || 'profile' === $current_screen->base || 'edit' === $current_screen->base ) ) {
return $args;
}

// Do not filter the avatar if this is doing a heartbeat request on WP refresh lock.
if ( wp_doing_ajax() && isset( $_POST['action'] ) && 'heartbeat' === $_POST['action'] ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a nonce that can be verified here for the heartbeat?
(PHPCS failure)

return $args;
}

$coauthor = $this->get_coauthor_by( 'id', $id );
if ( false !== $coauthor && isset( $coauthor->type ) && 'guest-author' === $coauthor->type ) {
Expand Down
Loading