Here is how you should create shortcode.
First you will have to define $atts
item in get_userdata
because $atts
is an array. Also I think there is also some issues with uppercase attributes names, so you should use attribute in lower case. So instead of userID
, use userid
.
function getUserEmail_func( $atts ) {
$user_info = get_userdata( $atts['userid'] );
return $user_info->user_email;
}
add_shortcode( 'sme_user-email', 'getUserEmail_func' );
Have tested it and it’s working.