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

Issue#958/ unable to change avatar images sizes #959

Merged
merged 4 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class CoAuthors_Plus {
var $coauthors_meta_box_name = 'coauthorsdiv';
var $force_guest_authors = false;

var $gravatar_size = 25;

var $_pages_whitelist = array( 'post.php', 'post-new.php', 'edit.php' );

var $supported_post_types = array();
Expand Down Expand Up @@ -449,7 +447,7 @@ public function coauthors_meta_box( $post ) {
$avatar_url = get_avatar_url( $coauthor->ID );
?>
<li>
<?php echo get_avatar( $coauthor->ID, $this->gravatar_size ); ?>
<?php echo get_avatar( $coauthor->ID ); ?>
<span id="<?php echo esc_attr( 'coauthor-readonly-' . $count ); ?>" class="coauthor-tag">
<input type="text" name="coauthorsinput[]" readonly="readonly" value="<?php echo esc_attr( $coauthor->display_name ); ?>" />
<input type="text" name="coauthors[]" value="<?php echo esc_attr( $coauthor->user_login ); ?>" />
Expand Down Expand Up @@ -1839,11 +1837,11 @@ public function filter_pre_get_avatar_data_url( $args, $id ) {
$coauthor = $this->get_coauthor_by( 'id', $id );
if ( false !== $coauthor && isset( $coauthor->type ) && 'guest-author' === $coauthor->type ) {
if ( has_post_thumbnail( $id ) ) {
$args['url'] = get_the_post_thumbnail_url( $id, $this->gravatar_size );
$args['url'] = get_the_post_thumbnail_url( $id, array( $args['width'], $args['height'] ) );
} elseif ( isset( $coauthor->user_email ) ) {
$args['url'] = get_avatar_url( $coauthor->user_email );
$args['url'] = get_avatar_url( $coauthor->user_email, $args );
} else {
$args['url'] = get_avatar_url( '' ); // Fallback to default.
$args['url'] = get_avatar_url( '', $args ); // Fallback to default.
}
}
return $args;
Expand Down
2 changes: 2 additions & 0 deletions css/co-authors-plus.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
}
#coauthors-readonly ul li .avatar {
float: left;
width: 25px;
height: 25px;
}
#coauthors-readonly ul li .coauthor-tag {
display:block;
Expand Down