Skip to content

Instantly share code, notes, and snippets.

@mauriciogofas
Last active September 18, 2015 13:05
Show Gist options
  • Save mauriciogofas/9962f02707c503fd4f3e to your computer and use it in GitHub Desktop.
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
<?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