User Profile Picture

Description

WordPress currently only allows you to use custom avatars that are uploaded through Gravatar. Dew User Profile Picture enables you to use any photo uploaded into your Media Library as an avatar. This means you use the same uploader and library as your posts. No extra folders or image editing functions are necessary.

  • Version: 1.0.1
  • WordPress Version: 4.9 or higher
  • Tested up to: 5.2.3
  • PHP Version: 5.2.4 or higher

Installation

Just head to your WordPress dashboard, click on Plugin->Add New and search for User Profile Picture. Click install, and then activate.

OR

Download plugin (Click Here), click on Plugin->Add New->Upload. Click install, and then activate.

Setting a New Profile Image

Upload User Profile
Simply head to your profile or your user’s and find the section for Profile Image.

Click the upload and it’ll launch a modal where you can select an image for inclusion.

Displaying the Profile Image

Use the Template Function

There’s a built-in template function that will retrieve and display the profile image. It accepts the same arguments as get_the_post_thumbnail. Here’s an example of it in use.

<?php
/**
 * dew_profile_img
 *
 * Adds a profile image
 *
 * @param $user_id INT - The user ID for the user to retrieve the image for
 * @param $args mixed
    size - string || array (see get_the_post_thumbnail)
    attr - string || array (see get_the_post_thumbnail)
    echo - bool (true or false) - whether to echo the image or return it
 */
 //Assuming $post is in scope
if ( function_exists ( 'dew_profile_img' ) ) {
    $author_id = $post->post_author;
    dew_profile_img( $author_id,
        array(
            'size' => 'thumbnail',
            'attr' => array( 'alt' => 'Alternative Text' ),
            'echo' => true,
        )
    );
}

Also lets you:

  • Upload your own Default Avatar in your User settings.
  • Show the user’s Gravatar avatar or Default Avatar if the user doesn’t have a User Profile Picture.
  • Disable Gravatar avatars and use only local avatars.
  • Allow Contributors and Subscribers to upload their own avatars.
  • Limit upload file size and image dimensions for Contributors and Subscribers.