Well, for a store “store_gravatar” is it’s logo. Not profile image.
Try this shortcode – [wcfm_store_info data="user_avatar"]
this is the result of that:
<div class=”elementor-widget-container”>
<div class=”elementor-shortcode”><div class=”wcfmmp_store_info wcfmmp_store_info_user_avatar”><span style=”display:inline-block” class=”wcfmmp_store_info_content wcfmmp_store_info_content_user_avatar”></span></div></div>
</div>
and please note we do not want the user gravater that is defined in the wp, we want the profile image the vendor set in the WCFM interface.
there are not the same, although in your system code – it look like sometimes you regard them as such.
the shortcode you sent is not working and will not work as your plugin code is not handling it.
the switch will get into default…
default:
$data_value = get_user_meta( $store_id, $data_info, true );
if( $data_value && is_array( $data_value ) ) {
$data_value = implode( “, “, $data_value );
}
$content .= ‘<span style=”display:inline-block” class=”wcfmmp_store_info_content wcfmmp_store_info_content_’ . $data_info . ‘”>’ . apply_filters( ‘wcfmmp_additional_store_info’, $data_value, $data_info, $store_id ) . ‘</span>’;
break;
Yes, this default will return value for this.
Are you working on a multi site installation?
if you agree – so you understand the shortcode you wrote – will not return anything useful.
This is not multisite instalattion.
So – how can we get the vendor profile image that he set on his “personal” section in WCFM?
Please add this snippet to your site –
add_filter( 'wcfmmp_additional_store_info', function( $data_value, $data_info, $store_id ) {
global $WCFM, $wpdb, $blog_id, $wp;
if( $data_info == 'user_avatar' ) {
$data_value = get_user_meta( $store_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true );
if( !empty( $data_value ) && function_exists( 'wcfm_get_attachment_url' ) ) {
$data_value = wcfm_get_attachment_url( $data_value );
$data_value = '<img src="'.$data_value.'" width="150" />';
}
}
return $data_value;
}, 50, 3 );
bad solution. getting back hard codded image.
Why we have elementor?
all its needed is the dynamic SRC url to the image, then you can use it free in elementor.
see here:
$vendor_id = get_the_author_meta(‘ID’);
$wp_user_avatar_id = get_user_meta( $vendor_id, $wpdb->get_blog_prefix($blog_id).’user_avatar’, true );
$wp_user_avatar = wcfm_get_attachment_url( $wp_user_avatar_id );
if ( !$wp_user_avatar ) {
$wp_user_avatar = apply_filters( ‘wcfm_defaut_user_avatar’, $WCFM->plugin_url . ‘assets/images/user.png’ );
}
return [
‘id’ => $wp_user_avatar_id,
‘url’ => $wp_user_avatar
];
You didn’t notice my code properly. I had added “img” tag here – https://ibb.co/Qrc376T
Remove this line and it will return image url.