Forked from strangerstudios/my_pmpro_account_bullets_avatars.php
Created
February 11, 2021 01:19
-
-
Save kimcoleman/e6f6ab5acedd47aacb9d0dad808b946b to your computer and use it in GitHub Desktop.
Display a member's gravatar and a link to update at Gravatar on the Membership Account page "Profile" section.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Show a link to Gravatar and an avatar preview on the Profile section of the Membership Account page. | |
* | |
* 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. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function show_gravatar_pmpro_account_bullets_top() { | |
global $current_user; | |
echo '<li class="alignright" style="display: inline-block; list-style: none; margin: -5rem 0 0 0;">' . get_avatar( $current_user->ID, 160 ) . '</li>'; | |
} | |
add_action( 'pmpro_account_bullets_top', 'show_gravatar_pmpro_account_bullets_top' ); | |
function show_gravatar_pmpro_account_bullets_bottom() { | |
echo '<li><strong>' . __( 'Avatar', 'my-textdomain' ) . ':</strong> <a href="http://gravatar.com/" target="_blank">' . __('Update at Gravatar.com', 'my-textdomain') . '</a></li>'; | |
} | |
add_action( 'pmpro_account_bullets_bottom', 'show_gravatar_pmpro_account_bullets_bottom'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Recommended Plugins for WordPress User Avatar Support in Your Membership Site" at Paid Memberships Pro here: https://www.paidmembershipspro.com/recommended-plugins-for-user-avatar-management-on-your-wordpress-membership-site/