Adding Avatar image to Email


Home Forums Front End PM PRO Adding Avatar image to Email

This topic is: Resolved
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #22124
    Jon Harari
    Participant

    Hi,

    How can we include the Sender’s avatar image to the email notification that is sent to the recipient? I see there are several fields like {{subject}}, {{message}}, {{message_url}}, etc. but can we also add avatar image?

    Thanks,
    Jon

    #22215
    Shamim Hasan
    Keymaster
    #26719
    c-alle
    Participant

    I would like to add the profile image of the sender and receiver in the e-mail notification, what code should I use?
    Thanks.

    #26768
    Shamim Hasan
    Keymaster

    You can follow above link.
    Do you use any plugin for profile image? Do you know how to get profile image url form user id?

    #26770
    c-alle
    Participant

    Hi, thanks for the reply. I use Ultimate Member.

    #26774
    Shamim Hasan
    Keymaster

    You can show them above link so that they can modify that as you need.
    Or
    Ask them how to get profile image url from user id and let me know so that i can modify that code as you need.

    #26776
    c-alle
    Participant

    Thanks, I tried to ask how to get the url of the profile picture. I await their response.

    #26787
    c-alle
    Participant


    $user_IDER = get_current_user_id (); (Here you recover ID, in this case current user)
    um_fetch_user ($user_IDER); (Here you set profile IDs for which you want to obtain the url of the avatar)
    $avatar_uri = um_get_avatar_uri (um_profile ('profile_photo'), 32); (Here you get avatars of that ID)
    echo $avatar_uri; (Here you can see the url of the avatar)

    Can this help you?

    thanks.

    #26790
    c-alle
    Participant

    Otherwise with this code you can see the avatar directly.


    $user_IDER = get_current_user_id (); (Here you recover ID, in this case current user)
    um_fetch_user ($user_IDER); (Here you set profile IDs for which you want to get the avatar)
    echo get_avatar( um_user('ID'), 32 );

    #26798
    Shamim Hasan
    Keymaster

    add following code in your theme’s (child theme’s if using) functions.php

    add_filter( 'fep_eb_email_legends', function( $legends, $mgs, $user_email ){
    	$legends['cus_sender_avatar'] = array(
    		'description'  => __('Sender Avatar', 'front-end-pm'),
    		'where'        => array( 'newmessage', 'reply' ), //where this tag will be used
    		'replace_with' => $mgs ? get_avatar( $mgs->mgs_author, 64 ) : '',
    	);
    	$legends['cus_receiver_avatar'] = array(
    		'description'  => __('Receiver Avatar', 'front-end-pm'),
    		'where'        => array( 'newmessage', 'reply' ), //where this tag will be used
    		'replace_with' => $mgs ? get_avatar( $user_email, 64 ) : '',
    	);
    	return $legends;
    }, 10, 3);
    

    Then you can use {{cus_sender_avatar}} and {{cus_receiver_avatar}}

    #26800
    c-alle
    Participant

    Perfect, thank you very much. ????

Viewing 11 posts - 1 through 11 (of 11 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.