Page 1 of 1

[Snippet] Avatars in PM Inbox Outbox v.0.0.3 (en)

PostPosted: 17 May 2016, 14:29
by Sekuro
Avatars in PM Inbox Outbox v.0.0.3 (en)

Snippet-Title: Avatars in PM Inbox / Outbox
Snippet-Version: 0.0.3
Snippet-Autor: 4seven

Request-Thread:
http://www.phpbb.com/community/viewtopi ... #p12842819
Request by: kiore

Request Thread (History-Addition): http://www.phpbb.com/community/viewtopi ... #p12855022
Request by (History-Addition): trickoff

Snippet-Description:
With this Snippet you can display the Avatars of Sender in PM 'Inbox' and Recipients in 'Outbox' and 'Sent Messages' Folder. Also u see Avatars in 'PM-History'. If no Avatar is present, a 'no-avatar-image' is shown..

Snippet-Version: phpBB 3.0.x
Snippet-Language: mutlilingual
Snippet-Styles: prosilver

Instruction

NOTE:
First you must install this snippet:
[Snippet] Avatar everywhere
viewtopic.php?f=12&t=117


After that...

copy

no_avatar.png to images/no_avatar.png

Image

rightclick on image > save target under...

open

includes/functions_privmsgs.php

find

Code: Select all
                'SUBJECT'            => $subject

before add

Code: Select all
                // Avatars in PM Inbox / Outbox / 4seven / 2010
                'HISTORY_AVATAR'            => (($user->optionget('viewavatars')) && (!empty($row['user_avatar']))) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '<img src="' . $phpbb_root_path . 'images/no_avatar.png" alt="" />', 
                
// Avatars in PM Inbox / Outbox / 4seven / 2010                       

open

includes/ucp/ucp_pm_viewfolder.php

find

Code: Select all
                    // Send vars to template                      

before add

Code: Select all
                // Avatars in PM Inbox / Outbox / 4seven / 2010
                if ($folder_id !== PRIVMSGS_INBOX)
                {
                $sql2 = 'SELECT user_id, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height
                        FROM '
 . USERS_TABLE . '
                        WHERE ' 
$db->sql_in_set('user_id'substr($row['to_address'],2));
                $result2 = $db->sql_query($sql2);
                $row2 = $db->sql_fetchrow($result2);
                $db->sql_freeresult($result2);
                }
                // Avatars in PM Inbox / Outbox / 4seven / 2010                       

find

Code: Select all
                        'PM_CLASS'            => ($row_indicator) ? 'pm_' . $row_indicator . '_colour' : ''

after add

Code: Select all
                        // Avatars in PM Inbox / Outbox / 4seven / 2010
                        'MESSAGE_AVATAR'            => (($folder_id == PRIVMSGS_INBOX) && ($user->optionget('viewavatars')) && (!empty($row['user_avatar']))) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '<img src="' . $phpbb_root_path . 'images/no_avatar.png" alt="" />',
                        
                        
'RECIPIENTS_AVATAR'         => (($folder_id !== PRIVMSGS_INBOX) && ($user->optionget('viewavatars')) && (!empty($row2['user_avatar']))) ? get_user_avatar($row2['user_avatar'], $row2['user_avatar_type'], $row2['user_avatar_width'], $row2['user_avatar_height']) : '<img src="' . $phpbb_root_path . 'images/no_avatar.png" alt="" />',
                        // Avatars in PM Inbox / Outbox / 4seven / 2010                    

find

Code: Select all
p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported

replace with

Code: Select all
p.bcc_address, u.username, u.username_clean, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, p.message_reported


open

styles/prosilver/template/ucp_pm_history.html

find

Code: Select all
<h3><a href="{history_row.U_VIEW_MESSAGE}" 

before add

Code: Select all
                    <dl class="postprofile" style="position:relative;left:20px;right:20px;">
                    <dt style="position:relative;top:10px;left:-10px;text-align:center;">
                    {history_row.HISTORY_AVATAR}
                    </dt>
                    <dd>&nbsp;</dd>
                    <dd>&nbsp;</dd>
                    <dd>&nbsp;</dd>
                    </dl


open

styles/prosilver/template/ucp_pm_viewfolder.html

find

Code: Select all
                            <!-- IF messagerow.S_PM_DELETED --> 

before add

Code: Select all
    <!-- IF not S_SHOW_RECIPIENTS --><dd class="mark_avatar">{messagerow.MESSAGE_AVATAR}</dd><!-- ELSE --><dd class="mark_avatar">{messagerow.RECIPIENTS_AVATAR}</dd><!-- ENDIF --> 


open

styles/prosilver/theme/content.css

find

Code: Select all
    dd.info 

before add

Code: Select all
dd.mark_avatar {
        width: 230px;
        text-align: center;
        line-height: 200%;
    


clear all board- and browser-caches

enjoy



Additional Links

[Snippet] Avatar everywhere: viewtopic.php?f=12&t=117

"get_user_avatar_thumb" Resize-Addition by trickoff: http://www.phpbb.com/community/viewtopi ... #p12885481