Give members a more personalized experience on your membership site by showing their avatar in a widget.
This recipe demonstrates how to add a user avatar to the “Log In Form” widget using the pmpro_logged_in_welcome_before_menu hook.
The Code Recipe
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
In the screenshot of the widget, there is also some custom CSS in the child theme. This will show the user’s avatar in the log in form widget with a rounded effect and floated left of the menu.
.pmpro_logged_in_welcome_wrap img.avatar { float: left; margin: 0 15px 15px 0; border-radius: 50%; }
Adding the Custom CSS to Your Website
This custom CSS can be placed in a stylesheet for PMPro Customizations or pasted directly into the Appearance > Customize > Additional CSS field. You can also include this CSS in your child theme’s style.css
file. Do not place custom CSS in any file in a theme that gets regularly updated or you will lose your code.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.