user profile photo with shortcode
-
Hi,
looking for a way to add a member profile photo to a page using a shortcode. I want to enhance profile page with custom design and displaying a profile photo in a separate section in addition to the profile form.
I managed to parse other elements like “about” using this shortcode [um_user meta_key=”about”], but when I add this shortcode [um_user meta_key=”profile_photo”], it returns a filename.jpg, not the actual photo.
I’ve added the below code in functions.php, that I found on this forum and it helped to parse those other elements. But profile pic is not being displayed no matter what. I
function um_user_shortcode( $atts ) {
$atts = extract( shortcode_atts( array(
‘user_id’ => 0,
‘meta_key’ => ”,
), $atts ) );if ( empty( $meta_key ) ) return;
if( empty( $user_id ) ) $user_id = um_profile_id();
$meta_value = get_user_meta( $user_id, $meta_key, true );
if( is_serialized( $meta_value ) ){
$meta_value = unserialize( $meta_value );
}if( is_array( $meta_value ) ){
$meta_value = implode(“,”,$meta_value );
}return apply_filters(“um_user_shortcode_filter__{$meta_key}”, $meta_value );
}
add_shortcode( ‘um_user’, ‘um_user_shortcode’ );Does anybody know how to solve this?
thanks!!
The topic ‘user profile photo with shortcode’ is closed to new replies.