get_avatar example



    /** * Handles the username column output. * * @since 4.3.0 * * @param WP_User $user The current WP_User object. */
    public function column_username( $user ) {
        $super_admins = get_super_admins();
        $avatar       = get_avatar( $user->user_email, 32 );

        echo $avatar;

        if ( current_user_can( 'edit_user', $user->ID ) ) {
            $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) )get_edit_user_link( $user->ID ) ) );
            $edit      = "<a href=\"{$edit_link}\">{$user->user_login}</a>";
        } else {
            $edit = $user->user_login;
        }

        ?>

            }
        }

        $can_edit_post = current_user_can( 'edit_post', $post->ID );

        if ( $can_edit_post && 'trash' !== $post->post_status ) {
            $lock_holder = wp_check_post_lock( $post->ID );

            if ( $lock_holder ) {
                $lock_holder   = get_userdata( $lock_holder );
                $locked_avatar = get_avatar( $lock_holder->ID, 18 );
                /* translators: %s: User's display name. */
                $locked_text = esc_html( sprintf( __( '%s is currently editing' )$lock_holder->display_name ) );
            } else {
                $locked_avatar = '';
                $locked_text   = '';
            }

            echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
        }

        $pad = str_repeat( '&#8212; ', $this->current_level );
        
function render_block_core_post_author( $attributes$content$block ) {
    if ( ! isset( $block->context['postId'] ) ) {
        $author_id = get_query_var( 'author' );
    } else {
        $author_id = get_post_field( 'post_author', $block->context['postId'] );
    }

    if ( empty( $author_id ) ) {
        return '';
    }

    $avatar = ! empty( $attributes['avatarSize'] ) ? get_avatar(
        $author_id,
        $attributes['avatarSize']
    ) : null;

    $link        = get_author_posts_url( $author_id );
    $author_name = get_the_author_meta( 'display_name', $author_id );
    if ( ! empty( $attributes['isLink'] && ! empty( $attributes['linkTarget'] ) ) ) {
        $author_name = sprintf( '<a href="%1$s" target="%2$s">%3$s</a>', esc_url( $link )esc_attr( $attributes['linkTarget'] )$author_name );
    }

    $byline  = ! empty( $attributes['byline'] ) ? $attributes['byline'] : false;
    
return $revision;
    }

    if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) {
        return false;
    }

    $author = get_the_author_meta( 'display_name', $revision->post_author );
    /* translators: Revision date format, see https://www.php.net/manual/datetime.format.php */
    $datef = _x( 'F j, Y @ H:i:s', 'revision date format' );

    $gravatar = get_avatar( $revision->post_author, 24 );

    $date      = date_i18n( $datefstrtotime( $revision->post_modified ) );
    $edit_link = get_edit_post_link( $revision->ID );
    if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) {
        $date = "<a href='$edit_link'>$date</a>";
    }

    $revision_date_author = sprintf(
        /* translators: Post revision title. 1: Author avatar, 2: Author name, 3: Time ago, 4: Date. */
        __( '%1$s %2$s, %3$s ago (%4$s)' ),
        $gravatar,
        

                        admin_url( 'revision.php' )
                    ),
                    "restore-post_{$revision->ID}"
                )
            );
        }

        if ( ! isset( $authors[ $revision->post_author ] ) ) {
            $authors[ $revision->post_author ] = array(
                'id'     => (int) $revision->post_author,
                'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '',
                'name'   => get_the_author_meta( 'display_name', $revision->post_author ),
            );
        }

        $autosave = (bool) wp_is_post_autosave( $revision );
        $current  = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
        if ( $current && ! empty( $current_id ) ) {
            // If multiple revisions have the same post_modified_gmt, highest ID is current.             if ( $current_id < $revision->ID ) {
                $revisions[ $current_id ]['current'] = false;
                $current_id                          = $revision->ID;
            }
<div class="akismet-jp-connect"> <h3><?php esc_html_e( 'Connect with Jetpack', 'akismet' ); ?></h3><?php         if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) {?> <p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p> <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> <input type="hidden" name="redirect" value="plugin-signup"/> <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/> </form> <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?> <p><?php             /* translators: %s is the WordPress.com username */
            echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p> <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?> <p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p> <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> <input type="hidden" name="redirect" value="upgrade"/> <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/> </form>
$actions_string .= "<span class='$action'>{$separator}{$link}</span>";
        }
    }
    ?> <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) )$comment ); ?>> <?php             $comment_row_class = '';

            if ( get_option( 'show_avatars' ) ) {
                echo get_avatar( $comment, 50, 'mystery' );
                $comment_row_class .= ' has-avatar';
            }
            ?> <?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?> <div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>"> <p class="comment-meta"> <?php                 // Comments might not have a post they relate to, e.g. programmatically created ones.                 if ( $comment_post_link ) {
                    


    $list_items_markup = '';
    if ( ! empty( $comments ) ) {
        // Prime the cache for associated posts. This is copied from \WP_Widget_Recent_Comments::widget().         $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
        _prime_post_caches( $post_idsstrpos( get_option( 'permalink_structure' ), '%category%' ), false );

        foreach ( $comments as $comment ) {
            $list_items_markup .= '<li class="wp-block-latest-comments__comment">';
            if ( $attributes['displayAvatar'] ) {
                $avatar = get_avatar(
                    $comment,
                    48,
                    '',
                    '',
                    array(
                        'class' => 'wp-block-latest-comments__comment-avatar',
                    )
                );
                if ( $avatar ) {
                    $list_items_markup .= $avatar;
                }
            }

        $override = apply_filters( 'override_post_lock', true, $post$user );
        $tab_last = $override ? '' : ' wp-tab-last';

        ?> <div class="post-locked-message"> <div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div> <p class="currently-editing wp-tab-first" tabindex="0"> <?php         if ( $override ) {
            /* translators: %s: User's display name. */
            printf( __( '%s is currently editing this post. Do you want to take over?' )esc_html( $user->display_name ) );
        } else {
            /* translators: %s: User's display name. */
            printf( __( '%s is currently editing this post.' )esc_html( $user->display_name ) );
        }
        ?> </p>
<?php _e( 'Biographical Info' ); ?></label></th> <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profile_user->description; // textarea_escaped ?></textarea> <p class="description"><?php _e( 'Share a little biographical information to fill out your profile. This may be shown publicly.' ); ?></p></td> </tr> <?php if ( get_option( 'show_avatars' ) ) : ?> <tr class="user-profile-picture"> <th><?php _e( 'Profile Picture' ); ?></th> <td> <?php echo get_avatar( $user_id ); ?> <p class="description"> <?php                                     if ( IS_PROFILE_PAGE ) {
                                        $description = sprintf(
                                            /* translators: %s: Gravatar URL. */
                                            __( '<a href="%s">You can change your profile picture on Gravatar</a>.' ),
                                            __( 'https://en.gravatar.com/' )
                                        );
                                    } else {
                                        $description = '';
                                    }

                                    
/** * Adds avatars to comment author names. * * @since 3.1.0 * * @param string $name Comment author name. * @param int $comment_id Comment ID. * @return string Avatar with the user name. */
    public function floated_admin_avatar( $name$comment_id ) {
        $comment = get_comment( $comment_id );
        $avatar  = get_avatar( $comment, 32, 'mystery' );
        return "$avatar $name";
    }

    /** * @return bool */
    public function ajax_user_can() {
        return current_user_can( 'edit_posts' );
    }

    /** * @global string $mode List table view mode. * @global int $post_id * @global string $comment_status * @global string $comment_type * @global string $search */


/** * Adds avatars to relevant places in admin. * * @since 2.5.0 * * @param string $name User name. * @return string Avatar with the user name. */
function floated_admin_avatar( $name ) {
    $avatar = get_avatar( get_comment(), 32, 'mystery' );
    return "$avatar $name";
}

/** * Enqueues comment shortcuts jQuery script. * * @since 2.7.0 */
function enqueue_comment_hotkeys_js() {
    if ( 'true' === get_user_option( 'comment_shortcuts' ) ) {
        wp_enqueue_script( 'jquery-table-hotkeys' );
    }
'<input type="checkbox" name="users[]" id="user_%1$s" class="%3$s" value="%1$s" />',
                $user_object->ID,
                /* translators: Hidden accessibility text. %s: User login. */
                sprintf( __( 'Select %s' )$user_object->user_login ),
                $role_classes
            );

        } else {
            $edit = "<strong>{$user_object->user_login}{$super_admin}</strong>";
        }

        $avatar = get_avatar( $user_object->ID, 32 );

        // Comma-separated list of user roles.         $roles_list = implode( ', ', $user_roles );

        $row = "<tr id='user-$user_object->ID'>";

        list( $columns$hidden$sortable$primary ) = $this->get_column_info();

        foreach ( $columns as $column_name => $column_display_name ) {
            $classes = "$column_name column-$column_name";
            if ( $primary === $column_name ) {
                

$avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
$default         = get_option( 'avatar_default', 'mystery' );
$avatar_list     = '';

// Force avatars on to display these choices. add_filter( 'pre_option_show_avatars', '__return_true', 100 );

foreach ( $avatar_defaults as $default_key => $default_name ) {
    $selected     = ( $default === $default_key ) ? 'checked="checked" ' : '';
    $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr( $default_key ) . "' {$selected}/> ";
    $avatar_list .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) );
    $avatar_list .= ' ' . $default_name . '</label>';
    $avatar_list .= '<br />';
}

remove_filter( 'pre_option_show_avatars', '__return_true', 100 );

/** * Filters the HTML output of the default avatar list. * * @since 2.6.0 * * @param string $avatar_list HTML markup of the avatar list. */
 else {
            $moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' );
        }
        ?> <<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>"> <?php if ( 'div' !== $args['style'] ) : ?> <div id="div-comment-<?php comment_ID(); ?>" class="comment-body"> <?php endif; ?> <div class="comment-author vcard"> <?php             if ( 0 != $args['avatar_size'] ) {
                echo get_avatar( $comment$args['avatar_size'] );
            }
            ?> <?php             $comment_author = get_comment_author_link( $comment );

            if ( '0' == $comment->comment_approved && ! $show_pending_links ) {
                $comment_author = get_comment_author( $comment );
            }

            printf(
                /* translators: %s: Comment author link. */
                
Home | Imprint | This part of the site doesn't use cookies.