Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sargespam

    (@sargespam)

    Thanks for the heads up.
    As mentioned, I just code for fun.
    Here is an alternative to modifying the core code of the plugin.

    Do steps 1 and 2 from the original post.
    Instead of step 3, use this code in the your theme’s files where get_avatar is used.

    <?php $user_info = get_userdata($post->post_author);
    $loginname = $user_info->user_login ;
    $DefaultAvatar = '/wp-content/uploads/defaultavatars/'.$loginname.'.png';
    $DefaultAvatarLink = get_bloginfo('url').$DefaultAvatar ;
    if (!file_exists($_SERVER['DOCUMENT_ROOT'].$DefaultAvatar)) {$DefaultAvatarLink = "" ;}
    echo get_avatar($post->post_author, '40' , $DefaultAvatarLink); ?>

    Change the 40 in the last line above to whatever you want the avatar size to be.

    The line to be replaced with code above will probably look like <?php echo get_avatar($post->post_author, '40'); ?>

    The problem is that this will not work in the comments section or with other plugins like https://www.ads-software.com/extend/plugins/author-avatars/

    Thread Starter sargespam

    (@sargespam)

    I have 368 fixed users on the site. The coding was easier than setting one profile at a time.

Viewing 2 replies - 1 through 2 (of 2 total)