Last active
September 18, 2015 13:05
-
-
Save mauriciogofas/9962f02707c503fd4f3e to your computer and use it in GitHub Desktop.
Custom WP Avatar via Gravity Forms Upload Field and Gravity Forms Users Registration Add-On
This file contains hidden or 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 | |
/* | |
Author: Mauricio Gofas | |
Author URL: https://www.gofas.com.br | |
*/ | |
// Custom Avatar via Gravity forms upload field | |
add_filter( 'get_avatar' , 'gfca_custom_avatar' , 1 , 5 ); | |
function gfca_custom_avatar( $avatar, $id_or_email, $size, $default, $alt ) { | |
$current_user = wp_get_current_user(); | |
$gfca_avatar = $current_user->your_custom_profile_image; | |
if ( $gfca_avatar ) { | |
$avatar = $gfca_avatar; // Gravity Forms Avatar | |
$avatar = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />"; | |
} | |
return $avatar; | |
} | |
// End Custom Avatar via Gravity forms pload field | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment