Store
Community Documentation

v3 Knowledgebase

How to Add Profile Photo to Email

For adding a profile photo to Email you need to add some variables.
You can make a plugin to do this.

Go to the AdminCP -> Extensions -> Plug in -> Create New Plugin

Settings:
*Product: core
*Module: mail
Title: Add Profile Image to Emails
Hook: mail_send_call
Active: yes

Code:
PHP:
$sMessage str_replace(array('{user_image}''{user_login}'), array(str_replace('%s''_75'Phpfox::getUserBy('user_image')), Phpfox::getUserBy('user_name')), $sMessage);
                        
$sMessagePlain str_replace(array('{user_image}''{user_login}'), array(str_replace('%s''_75'Phpfox::getUserBy('user_image')), Phpfox::getUserBy('user_name')), $sMessagePlain);
                        
                        
// Load plain text template
                        
$sTextPlain Phpfox::getLib('template')->assign(array(
                                    
'sName' => $aUser['full_name'],
                                    
'bHtml' => false,
                                    
'sMessage' => $this->_aMessagePlain !== null $sMessagePlain $sMessage,
                                    
'sEmailSig' => $sEmailSig,
                                    
'bMessageHeader' => $this->_bMessageHeader,
                                    
'sMessageHello' => Phpfox::getPhrase('core.hello_name', array('name' => $aUser['full_name']), falsenull$aUser['language_id'])
                                )
                            )->
getLayout('email'true);

                        
// Load HTML text template
                        
$sTextHtml Phpfox::getLib('template')->assign(array(
                                    
'sName' => $aUser['full_name'],
                                    
'bHtml' => true,
                                    
'sMessage' => nl2br($sMessage),
                                    
'sEmailSig' => nl2br($sEmailSig),
                                    
'bMessageHeader' => $this->_bMessageHeader,
                                    
'sMessageHello' => Phpfox::getPhrase('core.hello_name', array('name' => $aUser['full_name']), falsenull$aUser['language_id'])
                                )
                            )->
getLayout('email'true); 


Now you have two new variables:
{user_image}
{user_login}

In the top of mail template insert the code:
<a href="{site_url}index.php?do=/{user_login}/"><img src="{site_url}file/pic/user/{user_image}" /></a>

Result: