I am having trouble getting a shortcode to work with 1 attribute.
Here is my shortcode [sme_user-email userID="2"]
Here are my scripts - none of them work.
function getUserEmail_func($atts) {
extract(shortcode_atts(array('userID' => 1,), $atts));
$user_info = get_userdata($atts);
return $user_info->user_email;
}
add_shortcode('sme_user-email', 'getUserEmail_func');
.
function getUserEmail_func($atts) {
$user_info = get_userdata($atts);
return $user_info->user_email;
}
add_shortcode('sme_user-email', 'getUserEmail_func');
.
function getUserEmail_func($atts) {
$user_info = get_userdata($atts['userID]');
return $user_info->user_email;
}
add_shortcode('sme_user-email', 'getUserEmail_func');
This one works -- but I do not want to hardcode the user ID. I was hoping to be able to do it dynamically
function getUserEmail_func($atts) {
$user_info = get_userdata(2);
return $user_info->user_email;
}
add_shortcode('sme_user-email', 'getUserEmail_func');