Skip to main content

One of the key features of the Learner Profile widget in LearnDash is the user profile image displayed above the learner full name, which provides a level of personalisation to each individual user experience when viewing their own learning record.

The default image that is used for all new user accounts in WordPress is known as the ‘Mystery Person’ icon, which is a white icon set against a grey square. This default avatar can be changed in the WordPress Settings>Discussion screen to a small number of other available design options, most of which are (how can we put this delicately…) not as professional as you may like!

Plugins do exist that provide the ability for the user themselves to upload their own photo, such as the many high quality membership plugins available for WordPress today such as BuddyPress or ProfileGrid.

You may still however want to have a specific user profile image set as the default before a user has had the chance to change this themselves, or you may not want to provide the ability for a user to upload a photo at all, but would prefer that all users have a specific image such as a company or brand logo.

In order to achieve this, we can actually append the list of available avatars shown in the Default Avatar list in Settings>Discussions settings. To do this, we just need to upload a default photo to the WordPress site Media Library, and apply some custom PHP code to our theme’s functions.php file.

Step 1 – Upload Your Image to The Media Library

This is done in the usual way by clicking on Media>Add New in the WP-Admin screen. Remember that the profile image itself in the [ ld_profile ] learner profile widget shortcode provided by LearnDash LMS  is cropped around the edge with a circular frame, so the best type of image that you can use for the default avatar will be a fully square image (e.g. 128px by 128px) with the main area of interest being directly in the centre of the image, not extending directly to the edges.

You will also need to make a note of the image address once it has been uploaded to WordPress, as we will need this for what comes next.

Step 2 – Add the following code into your Theme Folder’s Functions.PHP File

add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;

After you have refreshed the Discussions settings screen you should then see the new Default Gravatar option available to select from the list, much like you can see here on our client’s site:

Chris Hodgson

Chris Hodgson

Chris Hodgson is an award-winning Digital learning Solutions Developer and Director of Discover eLearning Ltd. He supports SMEs and large firms through the process of integrating eLearning into their organisation. Chris has over 10 years experience working in Higher Education, Independent Training Provider Sector and Charity Sector learning and development.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.